[
  {
      "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"
   }
]
            Asked
            
        
        
            Active
            
        
            Viewed 67 times
        
    -2
            
            
        - 
                    I used http://support.oreilly.com/oreilly/topics/how_to_parse_json_in_java – Dipak Oct 11 '17 at 10:01
- 
                    Mention that in your question as well, along with the issue you are facing. – BlackBeard Oct 11 '17 at 10:04
- 
                    Someone has already answered this have a look. [link](https://stackoverflow.com/a/18977220/3119246) – InCh Oct 11 '17 at 10:07
- 
                    You can find your anser here: https://stackoverflow.com/questions/2591098/how-to-parse-json][1] – Mona Mohamadinia Oct 11 '17 at 10:22
2 Answers
0
            
            
        First create one class (Json_obj) for your json data.Then you can try this :
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);
Now your json data is converted in an object.You can fetch any value from that object.
 
    
    
        Michael Dodd
        
- 10,102
- 12
- 51
- 64
 
    
    
        Rimita Manna
        
- 27
- 2
0
            
            
        I suggest you just use jackson library instead.
You can just quickly have
ObjectMapper mapper = new ObjectMapper () // this reads json to Pojo and writes Pojo to json
YourPojoClass obj = mapper.readValue (....)
Reference: mkyong.com/java/jackson-2-convert-java-object-to-from-json
 
     
     
    