I have a Json Array like as below
[{"Name":"xxxx","Machine":"Machine1"},{"Name":"yyyy","Machine":"Machine2"},{"Name":"zzzz","Machine":"Machine3"}]
I need to parse that data and load into a hive table like below
Name Machine
xxxx Machine1
yyyy Machine2
zzzz Machine3
could someone please help?
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
;
+------+----------+
| name | machine |
+------+----------+
| xxxx | Machine1 |
| yyyy | Machine2 |
| zzzz | Machine3 |
+------+----------+
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With