2017-10-11 4 views
-2
[ 
    { 
     "updated_at":"2012-03-02 21:06:01", 
     "fetched_at":"2012-03-02 21:28:37.728840", 
     "description":null, 
     "language":null, 
     "title":"JOHN", 
     "url":"http://rus.JOHN.JOHN/rss.php", 
     "icon_url":null, 
     "logo_url":null, 
     "id":"4f4791da203d0c2d76000035", 
     "modified":"2012-03-02 23:28:58.840076" 
    }, 
    { 
     "updated_at":"2012-03-02 14:07:44", 
     "fetched_at":"2012-03-02 21:28:37.033108", 
     "description":null, 
     "language":null, 
     "title":"PETER", 
     "url":"http://PETER.PETER.lv/rss.php", 
     "icon_url":null, 
     "logo_url":null, 
     "id":"4f476f61203d0c2d89000253", 
     "modified":"2012-03-02 23:28:57.928001" 
    } 
] 
+2

mkyong.com/java/jackson-2-convert-java-object-to-from-json :

당신은 신속하게

ObjectMapper mapper = new ObjectMapper() // this reads json to Pojo and writes Pojo to json YourPojoClass obj = mapper.readValue (....) 

참조를 가질 수있다? – BlackBeard

+0

http://support.oreilly.com/oreilly/topics/how_to_parse_json_in_java – Dipak

+0

당신이 직면 한 문제와 함께 당신의 질문에도 언급했음을 언급하십시오. – BlackBeard

답변

0

먼저 당신의 JSON에 대한 하나 개의 클래스 (Json_obj)를 만드는 구조를 다음과 같이 JSON을 구문 분석하는 방법이 :

이제 JSON 데이터는 object.You에 변환됩니다
String json_str='[ { "updated_at":"2012-03-02 21:06:01", "fetched_at":"2012-03-02 21:28:37.728840", "description":null, "language":null, "title":"JOHN", "url":"http://rus.JOHN.JOHN/rss.php", "icon_url":null, "logo_url":null, "id":"4f4791da203d0c2d76000035", "modified":"2012-03-02 23:28:58.840076" }, { "updated_at":"2012-03-02 14:07:44", "fetched_at":"2012-03-02 21:28:37.033108", "description":null, "language":null, "title":"PETER", "url":"http://PETER.PETER.lv/rss.php", "icon_url":null, "logo_url":null, "id":"4f476f61203d0c2d89000253", "modified":"2012-03-02 23:28:57.928001" } ]'; 
Gson gson = new Gson(); 
Json_obj json_obj = gson.fromJson(json_str, Json_obj.class); 

수 그 오브젝트로부터 임의의 값을 꺼냅니다.

0

대신 잭슨 라이브러리를 사용하는 것이 좋습니다. 지금까지 시도 무엇