How to tell if JSON object is empty in jQuery
Posted
by
GrantU
on Stack Overflow
See other posts from Stack Overflow
or by GrantU
Published on 2013-11-01T15:47:47Z
Indexed on
2013/11/01
15:53 UTC
Read the original article
Hit count: 154
JavaScript
|jQuery
I have the following JSON:
{
"meta": {
"limit": 20,
"next": null,
"offset": 0,
"previous": null,
"total_count": 0
},
"objects": []
}
I'm interested in objects: I want to know if objects is empty and show an alert:
something like this:
success: function (data) {
$.each(data.objects, function () {
if data.objects == None alert(0)
else :alert(1)
});
© Stack Overflow or respective owner