how to find array length in json

var myObject = { “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”
}
]
}
]
}

$.each(myObject.Apps, function() {
alert(this.groups.length);
});

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s