1
我有數據結果:發生次數字的JavaScript
{
"statusCode": "T",
"statusMessage": "Success",
"resultFeasibility": {
"resultStatus": 7005,
"resultInfo": "Fiber
access is available"
},
"devices": {
"deviceID": "2573631",
"hostName": "ODP-SKB-FCP\/003 FCP\/D01\/003.01",
"networkLocation": "ODP-SKB-FCP\/003",
"technology": "GPON",
"stoCode": "SKB",
"maxSpeed": null,
"double": 0,
"icon": "resources\/images\/icon-gphone-blue.png",
"address": {
"latitude": "-6.915",
"longitude": "106.9185",
"zipCode": null,
"district": null,
"city": null,
"streetName": null,
"lineOne": null
},
"markerId": "7-2573631",
"type": "ALPRO"
}
}
我想顯示「設備ID」發生了多少,這是我的代碼: 代碼:
if (result.statusCode == 'T') {
this.odp = result.devices;
console.log(this.odp);
if (this.odp.length > 0) {
var alproType = this.odp.technology;
if (alproType == 'DSLAM')
this.feasibilityResult.push('feasibility DSLAM: ' + this.odp.length + ' DSLA');
else if (alproType == 'MSAN')
this.feasibilityResult.push('feasibility MSAN: ' + this.odp.length + ' MSAN');
else
this.feasibilityResult.push('feasibility ODP: ' + this.odp.length + ' ODP');
}
但輸出一片空白。任何人都可以幫助我?由於
看起來像'this.odp.length> 0'是'FALSE'。 –
您可以更新多個設備的JSON – Rajesh
哪個值完全爲null?您的第一個console.log日誌記錄爲空嗎?或者它是可行性結果數組? – Glubus