많은 페이지를 체크 아웃했지만 대부분의 자습서와 스크립트는이 유형의 JSON 출력과 함께 오류 코드를 반환합니다. 당신은 내가 잭슨을 사용하는 것이 좋습니다 것입니다 자바/역 직렬화 JSON 직렬화하려고하면 어떻게 내가?Java의 URL에서 JSON 데이터를 가져 오는 방법은 무엇입니까?
[
{
"user":{"id":"1","username":"user1"},
"item_name":"item1",
"custom_field":"custom1"
},
{
"user":{"id":"2","username":"user2"},
"item_name":"item2",
"custom_field":"custom2"
},
{
"user":{"id":"3","username":"user3"},
"item_name":"item3",
"custom_field":"custom3"
}
]
URL에서 이미 데이터를 다운로드했으며 읽는 방법을 알고 싶습니까? 아니면 처음부터 다운로드하는 방법을 알고 싶습니까? – ArjunShankar
가능한 복제본 : http://stackoverflow.com/questions/1688099/converting-json-to-java/1688182#1688182 –
많은 라이브러리가 전체 JSON 콘텐츠를 {}에 래핑하여 JSON 데이터를 래핑하려고합니다. 중괄호 안에. 나는 보통 JSONObject.fromObject (yourJsonString);을 읽는 데 json-lib를 사용합니다. – luukes