遍历JSON对象列表

尼克:

我从Web服务返回一个List <>作为JSON对象的列表。我正在尝试使用一个for循环来遍历列表并从属性中获取值。这是返回的JSON的示例:

{"d":[{"__type":"FluentWeb.DTO.EmployeeOrder",
 "EmployeeName":"Janet Leverling",
 "EmployeeTitle":"Sales Representative",
 "RequiredDate":"\/Date(839224800000)\/",
 "OrderedProducts":null}]}

因此,我尝试使用类似以下的方法提取内容:

function PrintResults(result) {

for (var i = 0; i < result.length; i++) { 
    alert(result.employeename);
}

应该怎么做?

veN:

今天遇到了同样的问题,您的话题对我有所帮助,所以这里找到解决方法;)

 alert(result.d[0].EmployeeTitle);

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章