Accessing elements of JSON object without knowing the key names

You can use the for..in construct to iterate through arbitrary properties of your object:

for (var key in obj.d) {
    console.log("Key: " + key);
    console.log("Value: " + obj.d[key]);
}

Leave a Comment