I have a set of data that is being passed on by the PHP\'s json_encode function. I\'m using the jQuery getJSON function to decode it:
json_encode
getJSON
One option is:
Object.keys(myObject).length
Sadly it not works under older IE versions (under 9).
If you need that compatibility, use the painful version:
var key, count = 0; for(key in myObject) { if(myObject.hasOwnProperty(key)) { count++; } }