length of json array in javascript code example
Example 1: json object length in javascript
const data = { a : 'b', c : 'd' };
const length = Object.keys(data).length;
//Length is 2
Example 2: javascript count elements in json object
var myObject = {'name':'Sherlock', 'address':'221b Bakerstreet','city': 'London'}
var count = Object.keys(myObject).length;
console.log(count);