无法从 IONIC 中的嵌套 JSON 数据中获取键和值
Not able to fetch key and value from nested JSON data in IONIC
我现在遇到一个问题,我无法从嵌套的 JSON data.Please 中获取键和值,请帮助我,我做错了什么。
<ion-item class="item item-thumbnail-left item-text-wrap" type="item-text-wrap" nav-transition="android" ng-repeat="data in hrINPROCandidateList | filter:search">
<p class="small-text blue-text ">{{data.cfname}}</p>
<div class="row" ng-repeat="(key,value) in data.note_detail_fields track by $index">
<div class="col field">{{key}}</div>
<div class="col field-info">{{value}}</div>
</div>
</ion-item>
JSON数据
{
"responseToken": 1,
"list": [
{
"candidate_id": "4",
"note_detail_fields": "{\"link\":\"View Interview Details\",\"job_title\":\"Sopra Executive\",\"Candidate\":\"Mark Ashton\",\"Interview_Type\":\"First Interview\",\"\":\"\",\"Duration\":\"30 minutes\",\"Date\":\"Wednesday, 23<sup>rd<\/sup> November 2016\",\"Time\":\"09:00 to 09:30\",\"Location\":\"london\"}",
"cfname": "Idris",
"clname": "Alba"
},
{
"candidate_id": "506",
"note_detail_fields": null,
"cfname": null,
"clname": null
},
{
"candidate_id": "32",
"note_detail_fields": "{\"link\":\"View Shared Job\",\"job_title\":\"Manager\",\"Location\":\"London, United Kingdom\",\"Package\":\"800 - 850 per day GBP\"}",
"cfname": "Sajal",
"clname": "Agarwal"
}
],
"totalCount": "4",
"success": 1,
"status": null
}
在应用程序中查看数据
您正在尝试遍历字符串而不是数组,创建一个过滤器来解析 data.note_detail_fields
中包含的 json
<div class="row" ng-repeat="(key,value) in data.note_detail_fields | fromJson track by $index">
<div class="col field">{{key}}</div>
<div class="col field-info">{{value}}</div>
</div>
app.filter('fromJson',function(){
return function(input){ return angular.fromJson(input); }
})
我现在遇到一个问题,我无法从嵌套的 JSON data.Please 中获取键和值,请帮助我,我做错了什么。
<ion-item class="item item-thumbnail-left item-text-wrap" type="item-text-wrap" nav-transition="android" ng-repeat="data in hrINPROCandidateList | filter:search">
<p class="small-text blue-text ">{{data.cfname}}</p>
<div class="row" ng-repeat="(key,value) in data.note_detail_fields track by $index">
<div class="col field">{{key}}</div>
<div class="col field-info">{{value}}</div>
</div>
</ion-item>
JSON数据
{
"responseToken": 1,
"list": [
{
"candidate_id": "4",
"note_detail_fields": "{\"link\":\"View Interview Details\",\"job_title\":\"Sopra Executive\",\"Candidate\":\"Mark Ashton\",\"Interview_Type\":\"First Interview\",\"\":\"\",\"Duration\":\"30 minutes\",\"Date\":\"Wednesday, 23<sup>rd<\/sup> November 2016\",\"Time\":\"09:00 to 09:30\",\"Location\":\"london\"}",
"cfname": "Idris",
"clname": "Alba"
},
{
"candidate_id": "506",
"note_detail_fields": null,
"cfname": null,
"clname": null
},
{
"candidate_id": "32",
"note_detail_fields": "{\"link\":\"View Shared Job\",\"job_title\":\"Manager\",\"Location\":\"London, United Kingdom\",\"Package\":\"800 - 850 per day GBP\"}",
"cfname": "Sajal",
"clname": "Agarwal"
}
],
"totalCount": "4",
"success": 1,
"status": null
}
在应用程序中查看数据
您正在尝试遍历字符串而不是数组,创建一个过滤器来解析 data.note_detail_fields
<div class="row" ng-repeat="(key,value) in data.note_detail_fields | fromJson track by $index">
<div class="col field">{{key}}</div>
<div class="col field-info">{{value}}</div>
</div>
app.filter('fromJson',function(){
return function(input){ return angular.fromJson(input); }
})