1
[
    {
        "0": "1",
        "1": "ANIMALS",
        "2": "7a415-lion.png",
        "id": "1",
        "category_name": "ANIMALS",
        "category_image": "http://dev1.sbsgroupsolutions.co.in/emoticonapp/admin/assets/uploads/7a415-lion.png"                               
    }


]
Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449

3 Answers3

1

Use GSON, library for reading and creating JSON for Java

mkubacki
  • 585
  • 2
  • 21
0

if something is returning you this json array then store it in a jsonarray object :-

JSONArray array;

Then instantiate a JSONObject :-

JSONObject object = array.getJSONObject();

give the necessary index.

and then use getString to get the values . Eg.

String s1 = object.getString("id");
Soumil Deshpande
  • 1,622
  • 12
  • 14
0

try this

JSONArray jsonArray = new JSONArray(jsonresponse);
JSONObject jsonObj = jsonArray.getJSONObject(0);
String categoryname=jsonObj.getString(category_name);
skyshine
  • 2,767
  • 7
  • 44
  • 84