kevinweil/elephant-bird — pull request #212 by housejester (2012-06-07 20:19:47+00:00)
Title: Json work (Jivesoftware)

These commits started with a need to have a JsonConverter with nesting support to be used by the SequenceFileLoader. There are several places in elephant-bird that do json work, and they seem to do it differently. It seems reasonable to start to refactor those places to delegate to a single json parsing utility.

So, the first commit simply adds JsonToPigParser, which is mostly the same code as what is in JsonLoader, but uses the jackson json parser instead of simple-json. It supports creating nested maps from nested json, as well as detecting string values that have json data (think avro json structures that have a field that is essentially a json payload). Has tests.

The next commit adds the JsonConverter for use with the SequenceFileLoader. The javadoc shows usage.

The final commit modifies the JsonStringToMap to delegate to the JsonToPigParser. I REALLY wish I could get the nesting to work here. It was easy enough to add, but pig refused to allow me to refer to the nested structures. What is strange is that the nesting support DOES work in the JsonConverter scenario.

Next steps might be to refactor the existing Json* classes to delegate to the JsonToPigParser.