If I am given the following data by a web-service:
{
\"d\": [
{
\"col1\": \"col 1 data 1\",
\"col2\": \"col 2 data 1\"
Try this:
var json = {
"d": [
{
"col1": "col 1 data 1",
"col2": "col 2 data 1"
},
{
"col1": "col 1 data 2",
"col2": "col 1 data 2"
}
]
};
alert(json.d[1].col1);
Specify the array index of d (starts with 0, so this would be 1) and then you can access child items. Here's a working example on jsFiddle.