0

i am trying to get csv_url , start_date values and hold it into one variable in json , please suggest me proper way.

[{"csv_url":"https://cdn.rawgit.com/everypolitician/everypolitician-data/f1541f4f2f494697bf8807518d8fbcda4ee8b505/data/Aland/Lagting/term-2015.csv","csv":"data/Aland/Lagting/term-2015.csv","name":"2015u20132019","id":"term/2015","slug":"2015","start_date":"2015-11-02"},{"end_date":"2015","csv_url":"https://cdn.rawgit.com/everypolitician/everypolitician-data/d8862e4d2d7d66d8cee83d2aefc97172f26ac594/data/Aland/Lagting/term-2011.csv","csv":"data/Aland/Lagting/term-2011.csv","name":"2011u20132015","id":"term/2011","slug":"2011","start_date":"2011"},{"end_date":"2011","csv_url":"https://cdn.rawgit.com/everypolitician/everypolitician-data/d8862e4d2d7d66d8cee83d2aefc97172f26ac594/data/Aland/Lagting/term-2007.csv","csv":"data/Aland/Lagting/term-2007.csv","name":"2007u20132011","id":"term/2007","slug":"2007","start_date":"2007"}]

i want

String[] url = {"csv_url" : "values ","start_date":"2015-11-02"};
Evgeniy Chiruk
  • 358
  • 1
  • 10

1 Answers1

0

@Javide is right, you can use GSON's easy to use library to parse your json response.

You can go to http://www.jsonschema2pojo.org/, paste your JSON response and select JSON then name your class, and this will create the classes and methods you need to parse JSON to POJO. After that you can iterate through the list and get the values you want.

This can help: Getting POJO objects into JTable

These tutorial series can help you understand how to deserialize JSON responses: https://www.youtube.com/watch?v=BbI8FdQOKNs

ADSquared
  • 207
  • 3
  • 12