本文介绍了android怎么样摆脱其阵列中的阵列JSON数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有,我想从本地服务器获取数据的应用程序。
像
I have an application where i want to fetch data from local server.like
{
"restarutant":{
"name":"Hotel Raja",
"photo":"http:\/\/i.imgur.com\/Mzt4u.jpg",
"address":"93, 2ndc ross, GDP etx.",
"area":"Vylaikaval",
"city":"Bangalore",
"location":["13.005621","77.577531"],
"phone":["9986377561","08023467969"],
"rating":"4",
"cuisines":["Chinese","Korean"],
"attributes":["smoking","parking","delivery"]
}
}
装置的阵列中阵列
请任何人告诉我如何检索这个每个数据。
谢谢
means array within an arrayplease anybody tell me how i retrieve each data from this.Thank you
推荐答案
试试这个code:
String str_json = "your json string from query";
try {
JSONObject topobj = new JSONObject(str_json);
JSONObject innerobj = topobj.getJSONObject("restarutant");
String name = innerobj.getString("name");
String photo = innerobj.getString("photo");
JSONArray cuisines = innerobj.getJSONArray("cuisines");
//etc etc...
} catch (JSONException e) {
e.printStackTrace();
}
这篇关于android怎么样摆脱其阵列中的阵列JSON数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!