Reputation: 35
i want to get the "Name" value (i.e xyz,abc,mno,mxc) from the json data, but as the parent node ids are different i am not able to parse it ..??
"all": {
"id55": {
"Tid": "1",
"Name": "xyz",
"TypeName": "author"
},
"id56": {
"Tid": "2",
"Name": "abc",
"TypeName": "author"
},
"id57": {
"Tid": "3",
"Name": "mno",
"TypeName": "author"
},
"id58": {
"Tid": "4",
"Name": "mzc",
"TypeName": "author"
},
}
Upvotes: 1
Views: 440
Reputation: 38102
You can use $.each() to iterate over your object and get Name
value:
$.each(all, function(i,val) {
console.log(all[i].Name);
});
Upvotes: 2
Reputation: 32532
var all = {
"id55": {
"Tid": "1",
"Name": "xyz",
"TypeName": "author"
},
"id56": {
"Tid": "2",
"Name": "abc",
"TypeName": "author"
},
"id57": {
"Tid": "3",
"Name": "mno",
"TypeName": "author"
},
"id58": {
"Tid": "4",
"Name": "mzc",
"TypeName": "author"
}
}
for (var a in all) {
console.log(all[a].Name);
}
output
xyz
abc
mno
mzc
Upvotes: 3