我想將下面的json保存到數組列表中。從json格式數據獲取字符串
「響應」採用字符串格式。
[
{
"code": "success"
},
{
"a_updated": "Y",
"a_id": "46155",
"a_ref_annonceur": "LP-L-46155",
"a_date_modified": "2013-11-21",
"a_time_modified": "15:13:52",
"a_titre_1": "Dans residence Pieds dans l’eau a Pointe aux Biches",
"a_titre_2": "In residence on the beach in Pointe aux Biches"
},
{
"a_updated": "N",
"a_id": "46161",
"a_ref_annonceur": "LP-L-46161",
"a_date_modified": "2013-11-22",
"a_time_modified": "09:27:31",
"a_titre_1": "Appartement à Bain Boeuf de 3 chambres",
"a_titre_2": "Bain Boeuf, 2 bedrooms appartment"
},
{
"a_updated": "Y",
"a_id": "47125",
"a_ref_annonceur": "LP-A-47125",
"a_date_modified": "2013-11-21",
"a_time_modified": "15:14:09",
"a_titre_1": "Terrain à route cotière, Mont Choisy avec batiment à renover.",
"a_titre_2": "Mont Choisy For Sale land on coastal road"
},
{
"a_updated": "Y",
"a_id": "50196",
"a_ref_annonceur": "LP-L-50196",
"a_date_modified": "2013-11-12",
"a_time_modified": "15:00:06",
"a_titre_1": "Villa à Trou aux Biches face a la plage",
"a_titre_2": "villa in Trou aux Biches infront of the beach"
},
{
"a_updated": "Y",
"a_id": "50197",
"a_ref_annonceur": "LP-A-50197",
"a_date_modified": "2013-11-12",
"a_time_modified": "15:00:02",
"a_titre_1": "Magnifique Villa de plain pied à Bon Espoir Piton sur terrain de 40 perches",
"a_titre_2": "For sale magnificent villa at Bon Espoir Piton"
},
{
"a_updated": "N",
"a_id": "81435",
"a_ref_annonceur": "LP-L-81435",
"a_date_modified": "2013-11-22",
"a_time_modified": "09:26:40",
"a_titre_1": "Bungalow de 3 chambres dans une Residence a Péreybère",
"a_titre_2": "Bungalow in a residence in Pereybere"
},
{
"a_updated": "Y",
"a_id": "93455",
"a_ref_annonceur": "LP-A-93455",
"a_date_modified": "2013-11-21",
"a_time_modified": "15:15:04",
"a_titre_1": "A vendre Grande Villa à Bain Boeuf",
"a_titre_2": "Villa in Bain Boeuf of 5 bedrooms"
},
{
"a_updated": "Y",
"a_id": "100109",
"a_ref_annonceur": "LP-A-100109",
"a_date_modified": "2013-10-17",
"a_time_modified": "10:13:24",
"a_titre_1": "A vendre villa de 5 chambres à Pointe aux Canonniers",
"a_titre_2": "For sale 5 bedroom villa in Pointe aux Canonniers"
},
{
"a_updated": "Y",
"a_id": "101680",
"a_ref_annonceur": "LP-L-101680",
"a_date_modified": "2013-10-17",
"a_time_modified": "10:09:11",
"a_titre_1": "Villa de 4 chambres en suite de grand standing à Belle Vue Harel",
"a_titre_2": "4 bedrooms villa in Belle Vue Harel"
},
{
"a_updated": "Y",
"a_id": "101682",
"a_ref_annonceur": "LP-L-101682",
"a_date_modified": "2013-10-17",
"a_time_modified": "09:57:18",
"a_titre_1": "Grande villa de 5 chambres + 1 study à Pointe aux Canonniers",
"a_titre_2": "5 Bedrooms villa + a study in Pointe aux Canonniers"
},
{
"a_updated": "Y",
"a_id": "101898",
"a_ref_annonceur": "LP-L-101898",
"a_date_modified": "2013-10-17",
"a_time_modified": "10:07:27",
"a_titre_1": "Villa meublée de 420M2 de 4 chambres + 1 bureau à Floréal",
"a_titre_2": "Fully furnished villa of 420M2 in Floréal"
},
{
"a_updated": "Y",
"a_id": "102670",
"a_ref_annonceur": "LP-A-102670",
"a_date_modified": "2013-10-17",
"a_time_modified": "10:14:40",
"a_titre_1": "villa sur terrain de 329,09M2 à Roches Noires",
"a_titre_2": "Villa in Roches Noires"
},
{
"a_updated": "Y",
"a_id": "102918",
"a_ref_annonceur": "LP-L-102918",
"a_date_modified": "2013-10-17",
"a_time_modified": "10:02:35",
"a_titre_1": "Villa climatissée à Pointe aux Canonniers",
"a_titre_2": "Airconditioned villa in Pointe aux Canonniers"
},
{
"a_updated": "Y",
"a_id": "102922",
"a_ref_annonceur": "LP-L-102922",
"a_date_modified": "2013-10-17",
"a_time_modified": "09:55:50",
"a_titre_1": "Magnifique villa à Belle vue Harel",
"a_titre_2": "Magnificent villa in Belle Vue Harel"
},
{
"a_updated": "Y",
"a_id": "103940",
"a_ref_annonceur": "LP-L-103940",
"a_date_modified": "2013-10-17",
"a_time_modified": "10:11:17",
"a_titre_1": "Villa individuelle dans une résidence privé à Trou aux Biches",
"a_titre_2": "Individual Villa in a private residence in Trou aux Biches"
}
]
這是我的工作
嘗試{
JSONArray jObject=new JSONArray(response);
for (int arr_size=0;arr_size<jObject.length();arr_size++){
JSONObject dataObject= (JSONObject) jObject.get(arr_size);
System.out.println("dataObject: "+dataObject.toString());
a_updated = dataObject.getString("a_updated");
}
我想只存儲所有值
a_updated,A_ID,a_ref_annonceur,a_date_modified,a_time_modified,a_titre_1,a_titre_2
in arraylist
你get.you得到什麼響應。 – Yugesh