我有一个Json数组,如下所示
[{"Name":"xxxx","Machine":"Machine1"},{"Name":"yyyy","Machine":"Machine2"},{"Name":"zzzz","Machine":"Machine3"}]
我需要解析该数据并加载到hive表中,如下所示
Name Machine
xxxx Machine1
yyyy Machine2
zzzz Machine3
有人可以帮忙吗?
答案 0 :(得分:3)
android {
....
dataBinding {
enabled = true;
}
}
select j.Name,j.Machine
from jsonarray t
lateral view explode(split(substr(t.json,2),'(?<=\\}),(?=\\{)')) e
lateral view json_tuple(e.col,'Name','Machine') j as Name,Machine
;