次のJSONオブジェクトがあります
var s = {
"TenantGroupName": "Fun Holidays",
"queue_details": [{
"queue_key": "1",
"channelId": "1",
"queue_name": "North India Travel",
"contacts": [{
"from": "meenar@interactcrm.com",
"subject": "Redemption Coupon",
"queue_time": "2:34",
"service_level_breached": "false",
"cduId": "4f8b9f2322c60106c0a800bd65cc0000",
"contactPkey": "8903"
}, {
"from": "sagarm@interactcrm.com",
"subject": "Redemption Coupon",
"queue_time": "2:34",
"service_level_breached": "false",
"cduId": "4f8b9f2322c60106c0a800bd65cc0000",
"contactPkey": "8903"
}, {
"from": "kaushalk@interactcrm.com",
"subject": "Redemption Coupon",
"queue_time": "2:34",
"service_level_breached": "false",
"cduId": "4f8b9f2322c60106c0a800bd65cc0000",
"contactPkey": "8903"
}, {
"from": "kaushalk@interactcrm.com",
"subject": "Redemption Coupon",
"queue_time": "8:05",
"service_level_breached": "true",
"cduId": "4f8b9f2322c60106c0a800bd65cc0000",
"contactPkey": "8903"
}, {
"from": "kaushalk@interactcrm.com",
"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": "meenar@interactcrm.com",
"subject": "Redemption Coupon",
"queue_time": "2:34",
"service_level_breached": "false",
"cduId": "4f8b9f2322c60106c0a800bd65cc0000",
"contactPkey": "8903"
}, {
"from": "raheels@interactcrm.com",
"subject": "Redemption Coupon",
"queue_time": "2:34",
"service_level_breached": "false",
"cduId": "4f8b9f2322c60106c0a800bd65cc0000",
"contactPkey": "8903"
}, {
"from": "sagarm@interactcrm.com",
"subject": "Redemption Coupon",
"queue_time": "2:34",
"service_level_breached": "false",
"cduId": "4f8b9f2322c60106c0a800bd65cc0000",
"contactPkey": "8903"
}, {
"from": "kaushalk@interactcrm.com",
"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 配列をループしたい。私はJavascriptで次のように書いています
上記のJSONオブジェクトを次のようにJavascriptに渡しました
function CreateQueue(jString) {
var jSonString = { "MyQueue": jString };
alert(jSonString.MyQueue.length);
}
上記の関数アラート: undefined
. 上記の JSON 文字列をループするにはどうすればよいですか?