Hitung objek JSON

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