hive拆分json数组取出各个值的第二层

select id,
secondLevel item,
indexValue score
from 
(
select 
id,
split(regexp_replace(regexp_extract(detail,'^\\[(.+)\\]$',1),'\\}]}\\,\\{', '\\}]}\\|\\|\\{'),'\\|\\|') as L1
select * from datatable.table
) as r1
lateral view explode(r1.L1) ss as col
lateral view json_tuple(ss.col,'indexName','secondLevel') rr as indexName,secondLevel
lateral view json_tuple(ss.col,'indexValue') rr as indexValue
where indexName = 'xxxx'

你可能感兴趣的:(json,hive)