I have the following JSON information. It is an array nested inside an object. I am trying to access components of the object, however I cant seem to figure out how to work with the object.
For instance, when I try to get the number of events in the array (there should be 2),
jsonObject.length
returns the character count. where as jsonObject[0].length
returns one, which in my opinion should be 2 (2 events).
{
"results": [
{
"eventName": "Rey",
"name": "Tar",
"dateOfShow": "2017-01-27T22:00:00",
"userGroupName": "Bit",
"eventHallName": "Grnn",
"imageSource": "test2.jpg"
},
{
"eventName": "Gor",
"name": "Skum",
"dateOfShow": "2017-01-30T20:00:00",
"userGroupName": "Gaf",
"eventHallName": "Gai",
"imageSource": "test1.jpg"
}
]
}
I have worked with JSON arrays before by parsing them, however when I parse this, it returns undefined for any value.
How would I get the number of events displayed in this JSON object using javascript?
jsonObject.results.length
– Jyothi Babu Araja 11 hours ago