마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

안드로이드 JSON 파싱 질문입니다.

0 추천
{"Response":{"Header":{"SuccessYN":"Y","ReturnCode":"00","ErrMsg":""},"Body":{"@xsi.type":"idxBody","IndexModel":[{"code":"A07","areaNo":1100000000,"date":2014051806,"today":7,"tomorrow":7,"theDayAfterTomorrow":""}]}}}
   
--------------------------------------------------------------------------------------------------------------------------
   String json = getUrl(jsonurl);  
   JSONObject jsonObj = new JSONObject(json);
   contacts = jsonObj.getJSONArray("IndexModel");

위는 JSON을 받아온 것이고

밑에는 저것을 사용하려고하는데

저렇게 하니까 안되네요...

방법좀 알려주시면 감사하겠습니다.~!!

블라썸 1 (120 포인트) 님이 2014년 5월 18일 질문

1개의 답변

+1 추천
{
	"Response":
	{
		"Header":
		{
			"SuccessYN":"Y",
			"ReturnCode":"00",
			"ErrMsg":""
		},
		"Body":
		{
			"@xsi.type":"idxBody",
			"IndexModel":
			[
				{
					"code":"A07",
					"areaNo":1100000000,
					"date":2014051806,
					"today":7,
					"tomorrow":7,
					"theDayAfterTomorrow":""
				}
			]
		}
	}
}

 

String json = getUrl(jsonurl);  
JSONObject jsonObj = new JSONObject(json);
JSONObject responseObj = jsonObj.get("Response");
JSONObject bodyObj = responseObj.get("Body");
contacts = bodyObj.getJSONArray("IndexModel");

 

쎄미 (162,410 포인트) 님이 2014년 5월 19일 답변
...