Get index of a key in json

The Solution to Get index of a key in json is


Its too late, but it may be simple and useful

var json = { "key1" : "watevr1", "key2" : "watevr2", "key3" : "watevr3" };
var keytoFind = "key2";
var index = Object.keys(json).indexOf(keytoFind);
alert(index);

~ Answered on 2013-10-16 05:59:49


Most Viewed Questions: