×

Please give details of the problem

Skip to content

How to print the keys and values of a JSONObject

1
2
3
4
5
6
7
var my_json = {
  "titi" : "toutou",
  "tata" : "toto"
};
for (var i in my_json) {
  alert("key : " + i + " - value : " + my_json[i]);
}

will return

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