You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by keeyong han <ke...@hotmail.com> on 2012/03/24 00:03:51 UTC

how to handle array field in JSON in PIG

A quick question on the JSON handling in PIG.
I tried some JsonLoader called Elephant-Bird to load and handle JSON data like the followings:{
   "SV":1,
   "AD":[
      {
         "ID":"46931606",
         "C1":"46",
         "C2":"469",
         "ST":"46931",
         "PO":1
      },
      {
         "ID":"46721489",
         "C1":"46",
         "C2":"467",
         "ST":"46721",
         "PO":5
      }
   ]
}
The loader works well for simple fields but it doesn't work well for any array field. I don't know how I can access elements in the array ("AD" field above) with this UDF or in any other way? Please advise.
Thanks,-K