を通じて私はJSON配列上記をループにしたいループJSONオブジェクト
var s = {
"TenantGroupName": "Fun Holidays",
"queue_details": [{
"queue_key": "1",
"channelId": "1",
"queue_name": "North India Travel",
"contacts": [{
"from": "[email protected]",
"subject": "Redemption Coupon",
"queue_time": "2:34",
"service_level_breached": "false",
"cduId": "4f8b9f2322c60106c0a800bd65cc0000",
"contactPkey": "8903"
}, {
"from": "[email protected]",
"subject": "Redemption Coupon",
"queue_time": "2:34",
"service_level_breached": "false",
"cduId": "4f8b9f2322c60106c0a800bd65cc0000",
"contactPkey": "8903"
}, {
"from": "[email protected]",
"subject": "Redemption Coupon",
"queue_time": "2:34",
"service_level_breached": "false",
"cduId": "4f8b9f2322c60106c0a800bd65cc0000",
"contactPkey": "8903"
}, {
"from": "[email protected]",
"subject": "Redemption Coupon",
"queue_time": "8:05",
"service_level_breached": "true",
"cduId": "4f8b9f2322c60106c0a800bd65cc0000",
"contactPkey": "8903"
}, {
"from": "[email protected]",
"subject": "Redemption Coupon",
"queue_time": "8:34",
"service_level_breached": "true",
"cduId": "4f8b9f2322c60106c0a800bd65cc0000",
"contactPkey": "8903"
}]
}, {
"queue_key": "1",
"channelId": "1",
"queue_name": "South India Travel",
"contacts": []
}, {
"queue_key": "1",
"channelId": "1",
"queue_name": "Summer 2012",
"contacts": [{
"from": "[email protected]",
"subject": "Redemption Coupon",
"queue_time": "2:34",
"service_level_breached": "false",
"cduId": "4f8b9f2322c60106c0a800bd65cc0000",
"contactPkey": "8903"
}, {
"from": "[email protected]",
"subject": "Redemption Coupon",
"queue_time": "2:34",
"service_level_breached": "false",
"cduId": "4f8b9f2322c60106c0a800bd65cc0000",
"contactPkey": "8903"
}, {
"from": "[email protected]",
"subject": "Redemption Coupon",
"queue_time": "2:34",
"service_level_breached": "false",
"cduId": "4f8b9f2322c60106c0a800bd65cc0000",
"contactPkey": "8903"
}, {
"from": "[email protected]",
"subject": "Redemption Coupon",
"queue_time": "9:34",
"service_level_breached": "true",
"cduId": "4f8b9f2322c60106c0a800bd65cc0000",
"contactPkey": "8903"
}]
}, {
"queue_key": "1",
"channelId": "3",
"queue_name": "Honeymoon",
"contacts": [{
"from": "Henry Williams",
"subject": "New Zealand",
"queue_time": "1:45",
"service_level_breached": "false",
"cduId": "4f8b9f2322c60106c0a800bd65cc0000",
"contactPkey": "8903"
}, {
"from": "Linda Simpson",
"subject": "Redemption Coupon",
"queue_time": "2:34",
"service_level_breached": "false",
"cduId": "4f8b9f2322c60106c0a800bd65cc0000",
"contactPkey": "8903"
}]
}, {
"queue_key": "1",
"channelId": "7",
"queue_name": "Feedback_SMS",
"contacts": [{
"from": "@sanjeev",
"subject": "Maldives",
"queue_time": "1:45",
"service_level_breached": "false",
"cduId": "4f8b9f2322c60106c0a800bd65cc0000",
"contactPkey": "8903"
}]
}, {
"queue_key": "1",
"channelId": "5",
"queue_name": "Feedback_Twitter",
"contacts": [{
"from": "9833202859",
"subject": "Wish to travel ...",
"queue_time": "1:45",
"service_level_breached": "false",
"cduId": "4f8b9f2322c60106c0a800bd65cc0000",
"contactPkey": "8903"
}]
}]
}
JSONオブジェクトには、次のしています。 undefined
:私は
function CreateQueue(jString) {
var jSonString = { "MyQueue": jString };
alert(jSonString.MyQueue.length);
}
上記の機能の警告を以下のように私はJavascriptにJSONオブジェクトの上に渡されたJavascriptの
に次のように書かれています。 JSON文字列の上をどのようにループすることができますか?
での世話をされますか? javascript consoleに 'alert(typeof myjsonstring)'と入力してみてください – phantasm