Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Pig >> mail # user >> Parsing a Complex JSON String?

Copy link to this message
Parsing a Complex JSON String?
Hi Folks,

I want to parse a string of complex JSON in Pig. Specifically, I want Pig to understand my JSON array as a bag instead of as a single chararray. When using JsonLoader, I can do this easily by specifying the schema, as in this question. Is there any way to either have Pig figure out my schema for me, or to specify it when Pig is parsing a string? I've been using JsonStringToMap, but can't find a way to specify Schema, or to have it properly understand my JSON array is an array and not a single char array. I looked at the code in JsonStringToMap, and it looks like it always specifies the schema for me as just a map of chararrays, which won't work for anything but the simplest JSON of a form like {string: string…}. Any ideas?