안드로이드 개발 질문/답변
(글 수 45,052)
[{"recipe_id1":"6","recipe_name1":"char kway teow","country_country_id1":"8"},{"recipe_id1":"5","recipe_name1":"chicken rice","country_country_id1":"8"},{"recipe_id1":"7","recipe_name1":"糖醋肉","country_country_id1":"2"},{"recipe_id1":"16","recipe_name1":"京酱肉丝","country_country_id1":"2"},{"recipe_id1":"102","recipe_name1":"새우튀김","country_country_id1":"1"},{"recipe_id1":"17","recipe_name1":"回鍋肉","country_country_id1":"2"},{"recipe_id1":"100","recipe_name1":"고추볶음","country_country_id1":"1"},{"recipe_id1":"101","recipe_name1":"케밥","country_country_id1":"1"}]
이렇게 JSON을 불러왔는데..
파싱을 어떻게해야하나요..!??
조언부탁드립니다.
2012.10.06 22:25:30
object = (JSONObject) new JSONTokener(body).nextValue();
if (object != null) {
JSONObject error = object.getJSONObject("error");
if (error != null) {
String code = error.getString("code");
String message = error.getString("message");
Log.d(TAG, code + " : " + message);
object = null;
}
}
2012.10.08 13:51:53
String str = [{"recipe_id1":"6","recipe_name1":"char kway teow","country_country_id1":"8"},{"recipe_id1":"5","recipe_name1":"chicken rice","country_country_id1":"8"}..........]
JSONArray aaa = new JSONArray(str);
int size = aaa.length();
for(int i = 0 : i < size ; i++){
JSONObject obj = aaa.getJSONObject(i);
String tag = obj.getString("키값");
.
.
.
}
아마도.