Iterate JSON Response with Javascript / JQuery -
i have following json response trying iterate javascript :-
{ "documentresponseresults": [ { "name": "example1", "id": "1" }, { "name": "example2", "id": "2" }, { "name": "example3", "id": "3" } ] }
i've tested makes sure valid json using online validator.
i'm receiving via response webmethod in asp.net.
in response looks this:-
d:"{"documentresponseresults":[{"name":"example1","id":"1"},{"name":"example2","id":"2"},{"name":"example3","id":"3"}]}"
i'm trying iterate items in json string.
i started off parsing :-
var jsondata = json.parse(response.d);
i've tried iterate array of objects accessing items collection, javascript informs me items property undefined.
can advise how iterate collection, , pull out properties such "name" & "id"
jsondata.documentresponseresults.foreach(function(result) { console.log(result.name) });
Comments
Post a Comment