JSON对象数组的长度 [英] Json Object Array Length

查看:223
本文介绍了JSON对象数组的长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与一些的Json工作类似于:

I'm working with some Json that is similar to:

{ 
   "Apps" : [
   { 
     "Name" : "app1",
     "id" : "1",
     "groups" : [ 
       { "id" : "1", "name" : "test group 1", "desc" : "this is a test group" },
       { "id" : "2", "name" : "test group 2", "desc" : "this is another test group" } 
     ]
   }
   ]
}

如果我解析它在jQuery中返回一个对象,我通过像这样的应用程序遍历:

If I parse it in jquery to return an object and I'm iterating through the apps like so:

$.each(myJsonObject.Apps, function() { ... };

我如何获得 this.groups

我试过


  • this.groups.length

  • this.groups.length()

  • $(本).groups.length()

和我找不到有良好的信息多级JSON对象的任何体面的文件。

and I cannot find any decent documentation on multiple tier json objects that have good information.

任何链接或示例或建议将是AP preciated。

Any links or examples or suggestions would be appreciated.

推荐答案

尝试:

$.each(myJsonObject.Apps, function(i, obj) { ... });

obj.Groups.length;

这篇关于JSON对象数组的长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆