var msg = "{'id': 1, 'name': '张飞'}"; msg = eval("("+msg+")"); for (var key in msg) { alert("key = " + key + " value = " + msg[key]); }