Answers for "node js get json length"

4

json object length in javascript

const data = { a : 'b', c : 'd' };

const length = Object.keys(data).length;

//Length is 2
Posted by: Guest on September-30-2020
1

get size of json object

var json=[{"id":"431","code":"0.85.PSFR01215","price":"2457.77","volume":"23.0","total":"565.29"},{"id":"430","code":"0.85.PSFR00608","price":"1752.45","volume":"4.0","total":"70.1"},{"id":"429","code":"0.84.SMAB00060","price":"4147.5","volume":"2.0","total":"82.95"},{"id":"428","code":"0.84.SMAB00050","price":"4077.5","volume":"3.0","total":"122.32"}] 
var obj = JSON.parse(json);
var length = Object.keys(obj).length; //you get length json result 4
Posted by: Guest on December-21-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language