get_json_object(string,'$.fileds')
string:转换的string对象,$.fileds 获取json中的字段值
data = {
"info1": {
"lat": 30.11248,
"lng": 20.4835
},
"info2": {
"default_recom": 1,
"invalid_text": {
"color": 0,
"model": [{"weight":8,"type":"apple"},{},{}]
},
"t": "tion"
},
name:"xiao"
}
1、获取json中第一层的值 name
select get_json_object(data,$.name) as info from table;
query:xiao
2、获取json中第二层 lat
select get_json_object(data,$.name.lat) from table;
query:30.11248
3、获取多层
select get_json_object(data,$.name.lat.a.b.c) from table;
4、获取array text第一个值
select get_json_object(data,$.info2.invalid_text.model[0]) from table;
query:{"weight":8,"type":"apple"}