Skip to content

How to print the keys and values of a JSONObject

var my_json = {
    "titi" : "toutou",
    "tata" : "toto"
};
for (var i in my_json) {
    alert("key : " + i + " - value : " + my_json[i]);
}

Return

key : titi - value : toutou
key : tata - value : toto