I have the following JSON response that i am trying to iterate with Javascript :-
{
"DocumentResponseResults": [
{
"Name": "Example1",
"Id": "1"
},
{
"Name": "Example2",
"Id": "2"
},
{
"Name": "Example3",
"Id": "3"
}
]
}
I've tested to makes sure its valid JSON using an online validator.
I'm receiving this via a response from a WebMethod in asp.net.
In the response it looks like this:-
d:"{"DocumentResponseResults":[{"Name":"Example1","Id":"1"},{"Name":"Example2","Id":"2"},{"Name":"Example3","Id":"3"}]}"
I'm trying to iterate the items in the JSON string.
I started off by parsing it like this :-
var jsonData = JSON.parse(response.d);
I've tried to iterate the array of objects by accessing the Items collection, but javascript informs me that the items property is undefined.
Can anyone advise how i iterate the collection, and pull out properties such as "Name" & "Id"