Jackson is your friend.
On Mon, Apr 9, 2012 at 5:14 PM, Russell Jurney <russell.jur...@gmail.com> wrote: > I need to be able to JSONize and return json:chararray's of any pig > datatypes, to be able to index complex types in ElasticSearch via > Wonderdog. See: https://issues.apache.org/jira/browse/PIG-2641 > > Does anyone have existing code they can contribute to a toJSON UDF that > handles all these types? > > For instance, Mozilla has this Map to JSON UDF: > https://github.com/mozilla-metrics/akela/blob/master/src/main/java/com/mozilla/pig/eval/json/MapToJson.java > > It is apache licensed, so I think I can paste it into a general toJSON UDF? > > > Elephant-bird has this code, which turns JSON to Maps: > https://github.com/kevinweil/elephant-bird/blob/master/src/java/com/twitter/elephantbird/pig/piggybank/JsonStringToMap.java > > ehh... thinking out loud... I'm just gonna do this in JRuby. If that has > issues, Python. > > Solved! :) > > -- > Russell Jurney twitter.com/rjurney russell.jur...@gmail.com datasyndrome.com