json 解析并存储在 Phonegap 中的数组列表中
在我的应用程序中,当用户单击按钮时,它会点击一个 url,我用来获取 json 格式的返回数据,如下所示
{
"Status":
{
"image":
[
{
"Large" : "http://XXXXXXXXXXXXXXXXXX.com/images/original/1316145577.jpg",
"Small" : "http://XXXXXXXXXXXXXXXXXX.com/images/thumb70/1316145577.jpg"
},
{ "Large" : "http://XXXXXXXXXXXXXXXXXX.com/images/original/1316146270.jpg",
"Small" : "http://XXXXXXXXXXXXXXXXXX.com/images/thumb70/1316146270.jpg"
},
{ "Large" : "http://XXXXXXXXXXXXXXXXXX.com/images/original/1316146473.jpg",
"Small" : "http://XXXXXXXXXXXXXXXXXX.com/images/thumb70/1316146473.jpg"
},
{ "Large" : "http://XXXXXXXXXXXXXXXXXX.com/images/original/1316147003.jpg",
"Small" : "http://XXXXXXXXXXXXXXXXXX.com/images/thumb70/1316147003.jpg"
},
{ "Large" : "http://XXXXXXXXXXXXXXXXXX.com/images/original/1316581422.jpg",
"Small" : "http://XXXXXXXXXXXXXXXXXX.com/images/thumb70/1316581422.jpg"
},
{ "Large" : "http://XXXXXXXXXXXXXXXXXX.com/images/original/1316694587.jpg",
"Small" : "http://XXXXXXXXXXXXXXXXXX.com/images/thumb70/1316694587.jpg"
}
]
}
}
我想要进行 json 解析并将在 Large 下命名的 URL 存储在数组中,并在 Array 下存储命名的 URL小到可以存储在另一个数组中。我希望使用 javascript
来完成此操作。
例如,在我的应用程序中的另一个网址中,我的 json 数据如下所示
{"Status":[{ "Id": "46", "Username": "guru" }]}
为此,我使用将数据获取为
var data = JSON.parse(my_JSON_object);
var id = data.Status[0].Id;
var name = data.Status[0].Username;
但如何解析首先提到的 json 数组。 怎么办,请朋友们帮忙
in my app when the user clicks a button, it hits an url and i use to get a return data in json format as follows
{
"Status":
{
"image":
[
{
"Large" : "http://XXXXXXXXXXXXXXXXXX.com/images/original/1316145577.jpg",
"Small" : "http://XXXXXXXXXXXXXXXXXX.com/images/thumb70/1316145577.jpg"
},
{ "Large" : "http://XXXXXXXXXXXXXXXXXX.com/images/original/1316146270.jpg",
"Small" : "http://XXXXXXXXXXXXXXXXXX.com/images/thumb70/1316146270.jpg"
},
{ "Large" : "http://XXXXXXXXXXXXXXXXXX.com/images/original/1316146473.jpg",
"Small" : "http://XXXXXXXXXXXXXXXXXX.com/images/thumb70/1316146473.jpg"
},
{ "Large" : "http://XXXXXXXXXXXXXXXXXX.com/images/original/1316147003.jpg",
"Small" : "http://XXXXXXXXXXXXXXXXXX.com/images/thumb70/1316147003.jpg"
},
{ "Large" : "http://XXXXXXXXXXXXXXXXXX.com/images/original/1316581422.jpg",
"Small" : "http://XXXXXXXXXXXXXXXXXX.com/images/thumb70/1316581422.jpg"
},
{ "Large" : "http://XXXXXXXXXXXXXXXXXX.com/images/original/1316694587.jpg",
"Small" : "http://XXXXXXXXXXXXXXXXXX.com/images/thumb70/1316694587.jpg"
}
]
}
}
i want to do json parsing and store the URLs named under Large to be stored in an Array and URLs named under Small to be stored in another array. I want this to be done using javascript
.
For example in my app in another url my json data is to be as follows
{"Status":[{ "Id": "46", "Username": "guru" }]}
For this i use to get the data as
var data = JSON.parse(my_JSON_object);
var id = data.Status[0].Id;
var name = data.Status[0].Username;
But how to parse for the json array mentioned first.
How to do this, pls help me friends
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过这种方式得到了答案
i got the answer by this way