I have a JSON Response as follows JSON :
var res =
{
"response": {
"data": {
"profilesearchsnippet": [
[
{
"profileInfo": {
"firstname": "Sundar",
"lastname": "v",
"gender": "male",
"country": "Afghanistan",
"state": "Badakhshan",
"city": "Eshkashem",
"pincode": "",
"plancode": "T001",
"userid": 13
},
"roleInfo": {
"defaultphotoid": 94
}
}
],
[
{
"profileInfo": {
"firstname": "ghg",
"lastname": "vbhvh",
"gender": "male",
"state": "Badakhshan",
"city": "Eshkashem",
"pincode": "454",
"plancode": "T001",
"userid": 22
},
"roleInfo": {
"defaultphotoid": 171
}
}
]
]
}
}
}
I want to fetch all firstname , country state city in a table.I tried assigning profilesearchsnippet value to variable var SearchData and try fetching firstname by using profileinfo,since its object. I am missing something somewhere need assistance.
HTML:
<tr ng-repeat= "item in searchData">
<td>{{item.profileInfo.firstname}}</td>
<td> {{item.profileInfo.country}}</td>
</tr>
JS:
var searchData = res.response.data.profilesearchsnippet[0];
var searchData = res.response.data.profilesearchsnippet[0];
this is just one of the search results. Try without the[0]
. – Sergio Prada 13 hours ago