在javascript中解析嵌套的json

时间:2014-11-14 12:47:29

标签: javascript json

这是我在javascript中的json响应。

{"1": {"11": "51","12": "52","13": "53","14": "54","15": "55"},"2": {"11": "51","12": "52","13": "53","14":"54","15": "55"},"4": {"11": "51","12": "52","13": "53","14": "54","15": "55"}}

我正在解析这个json,但它没有给出正确的输出。

for(var i=0; i<Object.keys(obj).length; i++)
{
  // here how should i parse the json and get all the key and values into the array.
}

由于

1 个答案:

答案 0 :(得分:0)

在Javascript中解析JSON的本地方法是JSON.parse(yourString)

您是否意识不到它或者您是否尝试创建自己的解析器?