should the JSON data be a JSON array format.

40 views
Skip to first unread message

Sandeep Ambekar

unread,
Dec 28, 2013, 8:26:35 AM12/28/13
to elephant...@googlegroups.com

I am trying to process a JSON file with below format.

{
"id": "0001",
"type": "donut",
"name": "Cake",
"ppu": 0.55,
"batters":
{
"batter":
[
{ "id": "1001", "type": "Regular" },
{ "id": "1002", "type": "Chocolate" },
{ "id": "1003", "type": "Blueberry" },
{ "id": "1004", "type": "Devil's Food" }
]
},
"topping":
[
{ "id": "5001", "type": "None" },
{ "id": "5002", "type": "Glazed" },
{ "id": "5005", "type": "Sugar" },
{ "id": "5007", "type": "Powdered Sugar" },
{ "id": "5006", "type": "Chocolate with Sprinkles" },
{ "id": "5003", "type": "Chocolate" },
{ "id": "5004", "type": "Maple" }
]
}


when I run following Pig script.. i just see a random output....

register '/home/cloudera/workspace/elephant-bird-core-4.1.jar';
register '/home/cloudera/workspace/elephant-bird-pig-4.1.jar';
register '/home/cloudera/workspace/elephant-bird-hadoop-compat-4.1.jar';
register '/home/cloudera/workspace/google-collections-1.0.jar';
register '/home/cloudera/workspace/json_simple-1.1.jar';

json_data = load '/user/cloudera/json_nested_test_2.json' using com.twitter.elephantbird.pig.load.JsonLoader('-nestedLoad');
dump json_data;

([id#1004,type#Devil's Food])
([id#5004,type#Maple])


Am I missing anything.. please sugges...
Reply all
Reply to author
Forward
0 new messages