赞
踩
select json_tuple('{"user_name":"chimchim","age":30,"sex":"woman"}', 'user_name', 'age','sex')
select json_tuple(json, 'user_name', 'age', 'sex')
from (
select explode( --将json数组中的元素解析出来,转化为每行显示
split(regexp_replace(regexp_replace(
'[{"user_name":"chimchim","age":30,"sex":"woman"},{"user_name":"zonzon","age":2,"sex":"man"}]' --要解析的json内容
, '\\[|\\]', '') --将json数组两边的中括号去掉
,'\\}\\,\\{', '\\}\\;\\{') --将json数组元素之间的逗号换成分号
, '\\;')) --以分号作为分隔符(split函数以分号作为分隔)
as json) o;
<
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。