2021-08-12 拆分json嵌套

最近遇到上报json嵌套格式的数据,需要拆分,比较按麻烦
上报格式为

[{"con_pos":"00","spanX":1,"spanY":1,"app_package":"com.youku.phone","con_name":"优酷视频","con_type":"1"}, 
{"con_pos":"00","spanX":2,"spanY":1,"app_package":"com.vivo.doubletimezoneclock","con_name":"原子通知","con_type":"4"}, 
{"con_pos":"10","spanX":1,"spanY":1,"app_package":"com.taobao.taobao","con_name":"手机淘宝","con_type":"1"}, 
{"con_pos":"02","spanX":1,"spanY":1,"app_package":"com.bbk.iqoo.feedback","con_name":"意见反馈","con_type":"1"}, 
{"con_pos":"14","spanX":1,"spanY":1,"app_package":"com.android.bbkmusic","con_name":"i 音乐","con_type":"1"}, 
{"con_pos":"13","spanX":1,"spanY":1,"app_package":"com.vivo.weather","con_name":"天气","con_type":"1"}, 
{"con_pos":"34","spanX":1,"spanY":1,"app_package":"com.kaixinkan.ugc.video","con_name":"vivo短视频","con_type":"1"}, 
{"con_pos":"35","spanX":1,"spanY":1,"app_package":"com.vivo.gallery","con_name":"相册","con_type":"1"}, 
{"con_pos":"05","spanX":1,"spanY":1,"app_package":"com.bbk.launcher2","con_name":"变形器","con_type":"1"}, 
{"con_pos":"24","spanX":1,"spanY":1,"app_package":"com.vivo.space","con_name":"vivo 官网","con_type":"1"}, 
{"con_pos":"00","spanX":1,"spanY":1,"app_package":"com.android.dialer","con_name":"电话","con_type":"1"}, 
{"con_pos":"00","spanX":1,"spanY":1,"app_package":"com.eg.android.AlipayGphone","con_name":"支付宝","con_type":"1"}, 
{"con_pos":"20","spanX":1,"spanY":1,"app_package":"com.vivo.browser","con_name":"浏览器","con_type":"1"}, 
{"con_pos":"03","spanX":1,"spanY":1,"app_package":"com.android.BBKClock","con_name":"闹钟时钟","con_type":"1"}, 
{"con_pos":"11","spanX":1,"spanY":1,"app_package":"com.ss.android.ugc.aweme","con_name":"抖音","con_type":"1"}, 
{"con_pos":"25","spanX":1,"spanY":1,"app_package":"com.android.camera","con_name":"镜头包","con_type":"1"}, 
{"con_pos":"20","spanX":1,"spanY":1,"app_package":"com.ss.android.article.news","con_name":"今日头条","con_type":"1"}, 
{"con_pos":"10","spanX":1,"spanY":1,"app_package":"com.android.mms","con_name":"信息","con_type":"1"}, 
{"con_pos":"23","spanX":2,"spanY":1,"app_package":"com.vivo.musicwidgetmix","con_name":"原子随身听","con_type":"4"}, 
{"con_pos":"01","spanX":4,"spanY":1,"app_package":"com.vivo.puresearch","con_name":"搜索","con_type":"4"}, 
{"con_pos":"30","spanX":1,"spanY":1,"app_package":"com.android.camera","con_name":"相机","con_type":"1"}, 
{"con_pos":"01","spanX":1,"spanY":1,"app_package":"com.android.bbkcalculator","con_name":"计算器","con_type":"1"}, 
{"con_pos":"11","spanX":1,"spanY":1,"app_package":"com.android.bbksoundrecorder","con_name":"录音机","con_type":"1"}, 
{"con_pos":"15","spanX":1,"spanY":1,"app_package":"com.android.settings","con_name":"设置","con_type":"1"}, 
{"con_pos":"04","spanX":1,"spanY":1,"app_package":"com.bbk.appstore","con_name":"应用商店","con_type":"1"}, 
{"con_pos":"01","spanX":1,"spanY":1,"app_package":"com.tencent.news","con_name":"腾讯新闻","con_type":"1"}, 
{"con_pos":"10","spanX":1,"spanY":1,"app_package":"com.tencent.qqlive","con_name":"腾讯视频","con_type":"1"}, 
{"con_pos":"21","spanX":1,"spanY":1,"app_package":"com.vivo.compass","con_name":"指南针","con_type":"1"}]

这是其中一组,有n组
拆分思路为
删除字符串前后的[],格式为{json},{json},将josn字符串中的分隔符代换成||,格式{json}||{json}
1、 函数regexp_extract
2、函数regexp_replace
3、函数split
4、函数lateral view explode

你可能感兴趣的:(2021-08-12 拆分json嵌套)