循环遍历JSON对象列表 [英] Loop through JSON object List
本文介绍了循环遍历JSON对象列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从Web服务返回List<>作为JSON对象列表。我试图使用for循环迭代列表并从属性中获取值。这是返回JSON的示例:
I am returning a List<> from a webservice as a List of JSON objects. I am trying to use a for loop to iterate through the list and grab the values out of the properties. This is a sample of the returning JSON:
{"d":[{"__type":"FluentWeb.DTO.EmployeeOrder",
"EmployeeName":"Janet Leverling",
"EmployeeTitle":"Sales Representative",
"RequiredDate":"\/Date(839224800000)\/",
"OrderedProducts":null}]}
所以我试图用某些东西提取内容像这样:
So I am trying to extract the contents using something like this:
function PrintResults(result) {
for (var i = 0; i < result.length; i++) {
alert(result.employeename);
}
应如何做?
推荐答案
今天有同样的问题,你的话题对我有帮助,所以这里解决了问题;)
had same problem today, Your topic helped me so here goes solution ;)
alert(result.d[0].EmployeeTitle);
这篇关于循环遍历JSON对象列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文