Reputation: 2142
What is the easiest way in Apache Hive to convert a Map (String, String) to a string representation in json format?
I've tried reflect and the JSONValue class, but it seems that the reflect udf only accepts primitives datatypes...
Your help is highly appreciated.
Kind regards Dennis
Upvotes: 3
Views: 14721
Reputation: 1630
Just use the "to_json" UDF from Brickhouse. ( http://github.com/klout/brickhouse ). It converts any arbitrary Hive structure into valid JSON. You can also parse arbitrary JSON formats into Hive structures with the "from_json" UDF.
Upvotes: 4