Muraliganesan
Muraliganesan

Reputation: 31

How to get jsonarry value from json response

am getting json response like this

{"content": "", "breadcrumb": "", "subtitle": "", "author": "", "title": "fas", "absolute_url": "http://abrilemlondres.com.br/599/voce-em-londres/fas", "commentsEnabled": false, "releaseDateTime": 1335524514, "image": ["http://abrilemlondres.com.br/m/up/40/00/553.jpg"], "tags": "ff"}

and how to get image value from this response......

Upvotes: 0

Views: 207

Answers (1)

Shachilies
Shachilies

Reputation: 1616

The below code snippet gives you the desired value.

String jsonExample = "{\"content\": \"\", \"breadcrumb\": \"\", \"subtitle\": \"\",                \"author\": \"\", \"title\": \"fas\", \"absolute_url\": \"http://abrilemlondres.com.br/599/voce-em-londres/fas\", \"commentsEnabled\": false, \"releaseDateTime\": 1335524514, \"image\": [\"http://abrilemlondres.com.br/m/up/40/00/553.jpg\"], \"tags\": \"ff\"}";

JSONObject jsonobject = new JSONObject(jsonExample);

JSONArray array = jsonobject.getJSONArray("image");

System.out.println("$$$$$$$$$      "+array.getString(0)+"&&&&&&&&     " );

Upvotes: 2

Related Questions