I am working on a GWT app that is receiving a JSON string, and I'm having a hard time getting down to the values of each object. I'm trying to transfer the incoming JSON string into an array of objects.
Here is the JSON (From Firebug response tab), The "d" is a .NET thing (Web Service Being Consumed is C#.
{
"d": [
{
"__type": "Event",
"ID": 30,
"Bin": 1,
"Date": "\/Date(1281544749000)\/",
"Desc": "Blue with white stripes.",
"Category": "1"
},
{
"__type": "Event",
"ID": 16,
"Bin": 3,
"Date": "\/Date(1281636239000)\/",
"Desc": "Yellow with pink stripes",
"Category": "1"
}
]
}
I'm trying to parse the JSON into objects, and then insert them into an array. I'm able to use Window.alert and get the entire "d" object to echo. However, when I try to access the elements of the array, GWT debugger just crashes.
//My GWT array to receive JSON Array
ArrayList<Item> itemInfo = new ArrayList<Item>();
//Getting response JSON into something I can work with.(THIS FAILS)
JSONArray jsonValue = JSONParser.parse(incomingJsonRespone);
//Just trying to verify I'm getting values
for (int i=0; i<jsonValue.size(); i++) {
JSONValue jsonItem = = JsonValue.get(i).getString();
Window.alert(jsonItem);
itemInfo.add(jsonItem);
}
I think I have narrowed down the problem to where the JSONArray instance is being created. Is there something blatantly wrong with how I'm trying to do this, because I'm not getting much help in the way of error messages?