Conde objetos JSON
var jsonObject = {"test1":1,"test2":2};
var keyCount = Object.keys(jsonObject).length;
Rick Astley
var jsonObject = {"test1":1,"test2":2};
var keyCount = Object.keys(jsonObject).length;