try using my UDF:
https://github.com/gerritjvv/pigutils/tree/master/pigudfs/udfs

it loads json as a map, and all nested objects as maps. I've not released
the jar yet so you'll need to compile a jar from source.

here's an example of how to use it:

l = load 'myfile.json.gz' using org.nts.pigutils.udfs.JSONLoader();
r = foreach l generate m#'user'#'age', m#'name';



On Thu, Aug 29, 2013 at 3:19 PM, jamal sasha <[email protected]> wrote:

> Hi,
>
> I have json file in follwoing format:
> { "_id" : "foo.com", "categories" : [], "h1" : { "bar==" : { "first" :
> 1281916800, "last" : 1316995200 }, "foo==" : { "first" : 1281916800, "last"
> : 1316995200 } }, "name2" : [ "foobarl.com", "foobar2.com" ], "rep" :
> null }
> So, how do i parse this json in pig..
>
> also, the categories and rep can have some char in it..and might not be
> always empty.
>
> Thanks
>
>
>
> This message may contain confidential and/or privileged information. If it
> has
> been sent to you in error, please reply to advise the sender of the error
> and
> then immediately delete this message.

Reply via email to