myJson = {"name":"nikita", "password":"1111"};
for(var p in myJson){//遍历json对象的每个key/value对,p为key
alert(p + " " + myJson[p]);
}

整理自:http://www.cnblogs.com/csj222/archive/2013/04/11/3013667.html

Related Posts: JavaScript遍历JSON示例 :