2017-10-11 13 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

まずこれを試すことができdata.ThenあなたのJSONのための一つのクラス(Json_obj)を作成します。

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); 

今すぐあなたのJSONデータをobject.Youに変換されますすることができますそのオブジェクトから任意の値を取り出します。

0

代わりにjacksonライブラリを使用することをお勧めします。あなたがこれまでに試してみました何

関連する問題