I have the following data in Json how could I retrieve data from this file
{\"first_name\":\"immi\",\"last_name\":\"Ahmad\",\"contact_no\":\"0333333\",\"dob\":\"
if your responce is to big than @tiny sunlight method not work
You cant do like
JSONObject userinfo= new JSONObject(result);
userinfo.getString("first_name");
JSONObject someObject = userinfo.getJsonObject("somthing")
JSONObject somthingElse = someObject.getJsonObject("somthingElse")
That become too hectic and nearly wasting your time
So BEST ANSWER is Gson Liabrary
Gson gson = new GsonBuilder().create();
Movie movie = gson.fromJson(response, Movie.class);
hear movie is class that you map from json - show in below link
you can do vise-varsa also
Gson gson = new GsonBuilder().create();
Responce mResponce = gson.fromJson(jsonStr , Responce .class);
String mName =mResponce.result.name;
https://stackoverflow.com/a/41218155/4741746
Hope you will understand which answer is best