怎么使用dw做一个网站,北京营销型网站建设哪家好,苏州专业网站建设开发,网站数据库丢失一、语法
目的#xff1a;在一个标准JSON字符串中#xff0c;按照指定方式抽取指定的字符串。
string get_json_object(string json, string path)
参数说明 json#xff1a;必填。STRING类型。标准的JSON格式对象#xff0c;格式为{Key:Value, Key:Val…一、语法
目的在一个标准JSON字符串中按照指定方式抽取指定的字符串。
string get_json_object(string json, string path)
参数说明 json必填。STRING类型。标准的JSON格式对象格式为{Key:Value, Key:Value,…}。如果遇到英文双引号需要用两个反斜杠\进行转义。如果遇到英文单引号需要用一个反斜杠\进行转义。path必填。STRING类型。表示在json中的path以$开头。$表示根节点。.或[‘’]表示子节点。*返回整个数组。 二、例在数据表test中有一列jsonData其数据如下
jsonData {ID:121,message:{name:Asher,location:[{county:浦东,city:上海},{county:西直门,city:北京}]}
}提取jsonData第一层数据ID
select get_json_object(jsonData,$.ID) from test--输出
121提取jsonData第二层数据name
select get_json_object(jsonData,$.message.name) from test--输出
Asher提取jsonData第二层数据location的第一项
select get_json_object(jsonData,$.message.location[0]) from test--输出
{county:浦东,city:上海}
提取jsonData第二层数据location的第一项的city
select get_json_object(jsonData,$.message.location[0].city) from test--输出
上海5.提取jsonData第三层数据city
select get_json_object(jsonData,$.message.location.city) from test--输出
[上海,北京]码字不易喜欢请点赞谢谢
参考
https://blog.csdn.net/Asher117/article/details/107984650
https://help.aliyun.com/zh/maxcompute/user-guide/get-json-object