如何解析此JSON的Android OBJ [英] how to parse this json obj android
本文介绍了如何解析此JSON的Android OBJ的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I M面临概率在解析这个OBJ
i m facing prob in parsing this obj
{
"id": 1909,
"permalink": "http:some url",
"title": "Voting begins for third phase of Bihar polls",
"excerpt": "some data.",
"date": "October 27, 2010 21:23",
"tags": [
"bihar",
"india-politics"
]
}
请告诉如何读取标签的价值如何读取标签值
pls tell how to read tags value how to read value of tags
推荐答案
让我们说jsonString等于例如字符串
Lets say "jsonString" is equal to that example string
JSONObject json = new JSONObject(jsonString);
int id = json.getInt("id");
String permalink = json.getString("permalink");
JSONArray tags = json.getJSONArray("tags");
String firstTag = tags.getString(0);
您需要抓取数据之前赶上JSONExceptions和可选检查json.has(someproperty)。
You need to catch JSONExceptions and optionally check json.has("someproperty") before grabbing data.
这篇关于如何解析此JSON的Android OBJ的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文