【发布时间】:2014-08-13 21:43:54
【问题描述】:
我有以下代码。
{
"id": 1,
"name": "A green door",
"price": 12.50,
"tags": ["home", "green"]
}
{
"id": 2,
"name": "A blue door",
"price": 10.50,
"tags": ["home", "blue"]
}
我希望能够只选择具有特定“id”的对象。
JSONObject json = new JSONObject(result);
String name = json.opString("name");
String price = json.optString("price");
String tags = json.optString("tags");
【问题讨论】: