JSON数组转换为Javascript数组

问题描述:

您好。我在JSON中获得了输出...现在我需要将这些数据转换为javascript ..

Hi. I got my output in JSON... Now I need to convert those data into javascript..

如何在javascript中编写代码?
我必须将图像显示到浏览器..只有通过在javascript中编写代码才有可能。
帮助我..

How to write the code in javascript? I have to display the images to the browser.. it is possible only by writing the code in javascript. Help me..

我的JSON输出是..

My JSON output is..

    [{"0":"101","member_id":"101","1":"3k.png","image_nm":"3k.png","2":"\/images\/phones\/","image_path":"\/images\/phones\/"},
     {"0":"102","member_id":"102","1":"mirchi.png","image_nm":"mirchi.png","2":"images\/phones\/","image_path":"images\/phones\/"},
     {"0":"103","member_id":"103","1":"masti.png","image_nm":"masti.png","2":"images\/phones\/","image_path":"images\/phones\/"}]



我在 JSON 中得到了我的输出...现在我需要将这些数据转换为
javascript ..

hai i got my output in JSON...now i need to convert those data into javascript..

使用 JSON.parse() 函数,以便将其转换为JS对象。

Use JSON.parse() function in order to convert it to JS object.

var obj = JSON.parse(yourJsonString);

现在你可以使用 for-in 循环迭代其每个项目:

And now you can use for-in loop to iterate over each of its items:

for (var x in obj){
  if (obj.hasOwnProperty(x)){
    // your code
  }
}