简体   繁体   中英

How to convert in hive a string representation of array of json objects back to array form

I am working in hive / SQL. I have a column in my table with strings which represent an array of json objects. I need to convert the strings to arrays of JSON strings.

For example, I have this,

"[{a:1, b:1},{a:2, b:2}]"

And I want to get this:

["{a:1, b:1}","{a:2, b:2}"]

Tried casting the string as array but that didn't work. Any ideas on how do this in a smart way short of splitting by "},{"?

没关系,我最终只是将“}”上的字符串分割开,然后将“}”加回每一段,效果很好!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM