Get total number of items on Json object?
In addition to kieran's answer, apparently, modern browsers have an Object.keys
function. In this case, you could do this:
Object.keys(jsonArray).length;
More details in this answer on How to list the properties of a javascript object
That's an Object and you want to count the properties of it.
Object.keys(jsonArray).length
References:
Object.keys
.- Kangax's compat table.