loop for array with sub arrays is not showing. Kindly advice. i am able to show the first array set but not able to show sub arrays of each set.
var json = [{
"Friends":[
{
'image' : '_assets/images/users/01.jpg',
'unread' : '22',
'name' : 'Salman Razak',
'message' : 'way to be happy...',
'lastchat' : '16th Feb 2015 | 9:30 pm'
},
{
'image' : '_assets/images/users/02.jpg',
'unread' : '22',
'name' : 'Shahid Saeed',
'message' : 'way to be happy...',
'lastchat' : '16th Feb 2005 | 9:30 pm'
}
],
"Colleagues":[
{
'image' : '_assets/images/users/02.jpg',
'unread' : '22',
'name' : 'Hyder Memon',
'message' : 'way to be happy...',
'lastchat' : '16th Feb 2015 | 9:30 pm'
}
]
}];
$.each(json, function () {
$.each(this, function (name, value) {
console.log(name + '=' + value);
$('ul').append('<li>'+ name + ', ' + json[name].join() +'</li>');
});
});
jsonan array?Friendsand aColleaguesproperty which themselves are arrays. You seem to think you have an array of arrays however.