I have a json response like {"xyz": ["a","b","c"]}. I am trying to get the values a, b, c as string using JsonObject and JsonArray classes.
What is the best way to do it?
asked Aug 16, 2012 at 12:21
rahul0789
3372 gold badges3 silver badges7 bronze badges
1 Answer 1
Probably you may need to do something like below
JSONObject myjson = new JSONObject(JSON_OBJECT);
JSONArray xyz_array= myjson.getJSONArray("xyz");
and iterate over the xyz_array to get each object in the array.
answered Aug 16, 2012 at 12:27
Meiyappan Kannappa
74910 silver badges37 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-java