The output of my JSON call can either be an Array or a Hash. How do I distinguish between these two?
Check for "constructor" property on the object. It is Array - it is an array object.
var a = { 'b':{length:0}, 'c':[1,2] } if (a.c.constructor == Array) for (var i = 0; i < a.c.length; i++) alert(a.c[i]); else for (var s in a.b); alert(a.b[s]);