Dray Dray - 1 month ago 6
Android Question

Getting String Value from Json Object Android

I am Begineer in Android.In my Project, I am getting the Following json from the HTTP Response.

[{"Date":"2012-1-4T00:00:00","keywords":null,"NeededString":"this is the sample string I am needed for my project","others":"not needed"}]


I want to get the "NeededString" from the above json.How to get it.

Answer

This might help you.

JSONArray arr = new JSONArray(result);
JSONObject jObj = arr.getJSONObject(0);
String date = jObj.getString("NeededString");
Comments