Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (7k points)

Here is my JSON

[{"thumb_url":"tb-1370913834.jpg","event_id":"15","count":"44","event_tagline":"this is a tagline","event_name":"5th birthday","event_end":"1370919600","event_start":"1370876400"}]

I need it to get it into an array and be able to call the strings by their respective keys. Can anybody help me?

1 Answer

0 votes
by (13.1k points)

ArrayList<String> list = new ArrayList<String>();     

JSONArray jSonArray = (JSONArray)jsonObject; 

if (jSonArray != null) { 

   for (int i=0;i<jSonArray.length();i++){ 

    list.add(jSonArray.getString(i));

   } 

Want to learn Java? Check out the core Java certification from Intellipaat. 

Related questions

0 votes
1 answer
asked Mar 6, 2021 in Java by dante07 (13.1k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Apr 4, 2021 in Java by dante07 (13.1k points)
0 votes
1 answer
asked Mar 31, 2021 in Java by Jake (7k points)

Browse Categories

...