loop through json object

July 2nd, 2010 by xrigher Leave a reply »

p = {k1: v1, k2, v2, k3, v3};
for (var key in p) {
if (p.hasOwnProperty(key)) { // make sure that the key you get is an actual property of an object, and doesn’t come from the prototype:
alert(p[key]);
}
}

Advertisement

Leave a Reply