I'm embarrassed to ask but I'm really having trouble getting the values out of some JSON. I just can't seem to access the array of values correctly.
I can get the values from this Json (fiddle: working jsfiddle) which uses the json response in the format below:
{
"items": [
{
"tags": [
"jqgrid"
],
"owner": {
"reputation": 21,
"user_id": 3038042,
"user_type": "registered",
"accept_rate": 70,
"profile_image": "https://www.gravatar.com/avatar/819ef95bfca002204f5bd00654fb9957?s=128&d=identicon&r=PG&f=1",
"display_name": "Amete",
"link": "http://stackoverflow.com/users/3038042/amete"
},
"is_answered": false,
"view_count": 5,
"answer_count": 1,
"score": 1,
"last_activity_date": 1423648956,
"creation_date": 1423605704,
"last_edit_date": 1423648956,
"question_id": 28442722,
"link": "http://stackoverflow.com/questions/28442722/jqgrid-set-focus-on-selectrow-not-working",
"title": "JqGrid Set Focus on SelectRow not working"
}
]
}
BUT I can't do the same for the Json below (failed jsfiddle)
[{
"Manufacturer": "Toyota",
"Sold": 1200,
"Month": "2012-11"
}, {
"Manufacturer": "Ford",
"Sold": 1100,
"Month": "2012-11"
}, {
"Manufacturer": "BMW",
"Sold": 900,
"Month": "2012-11"
}, {
"Manufacturer": "Benz",
"Sold": 600,
"Month": "2012-11"
}]
I know I am not accessing the array correctly but everything I've tried has failed.
Additionally, it looks simpler to use the JQuery $.getJSON approach but I can't make that work either...
Any advice would be much appreciated.