here is the code…but it is not allow to ask the whole code here…we solve the problem, if the effort is seem from your side …
Thread thread=new Thread(new Runnable() {
@SuppressWarnings("unused")
public void run()
{
try
{
HttpClient client=new DefaultHttpClient();
HttpGet request=new HttpGet("http://192.168.0.30/test.js");
HttpResponse response=client.execute(request);
HttpEntity entity=response.getEntity();
JSONObject jsonresponse=new JSONObject(EntityUtils.toString(entity));
Log.i("parse", jsonresponse.toString());
//start parsing
if(jsonresponse.getString("status").equalsIgnoreCase("success"))
{
JSONArray jsonarrayresponse=jsonresponse.getJSONArray("response");
JSONObject jsonobjectresponse=jsonarrayresponse.getJSONObject(0);
String id=jsonobjectresponse.getString("id");
String week=jsonobjectresponse.getString("week");
String date=jsonobjectresponse.getString("date");
String day=jsonobjectresponse.getString("day");
JSONArray checklist=jsonobjectresponse.getJSONArray("checklist_data");
JSONObject checklistjsonobject1=checklist.getJSONObject(0);
JSONObject checklistjsonobject2=checklist.getJSONObject(1);
String water=checklistjsonobject1.getJSONObject("awaken").getJSONArray("essential").getJSONObject(0).getString("aw_water");
String excercise=checklistjsonobject1.getJSONObject("awaken").getJSONArray("essential").getJSONObject(1).getString("aw_exercise");
String tonguescrape=checklistjsonobject1.getJSONObject("awaken").getJSONArray("optional").getJSONObject(0).getString("aw_tongue_scrape");
String meditation=checklistjsonobject1.getJSONObject("awaken").getJSONArray("optional").getJSONObject(1).getString("aw_meditation");
String journal=checklistjsonobject1.getJSONObject("awaken").getJSONArray("optional").getJSONObject(2).getString("aw_journal");
String dryskinbrush=checklistjsonobject1.getJSONObject("awaken").getJSONArray("optional").getJSONObject(3).getString("aw_dry_skin_brush");
String oilpull=checklistjsonobject1.getJSONObject("awaken").getJSONArray("optional").getJSONObject(4).getString("aw_Oil_pull");
String smoothie=checklistjsonobject2.getJSONObject("breakfast").getJSONArray("essential").getJSONObject(0).getString("br_smoothie");
String supplements=checklistjsonobject2.getJSONObject("breakfast").getJSONArray("essential").getJSONObject(1).getString("br_supplements");
String tulsitee=checklistjsonobject2.getJSONObject("breakfast").getJSONArray("essential").getJSONObject(2).getString("br_tulsi_tea");
String water2=checklistjsonobject2.getJSONObject("breakfast").getJSONArray("essential").getJSONObject(3).getString("br_water");
Log.i("parse", id);
Log.i("parse", week);
Log.i("parse", date);
Log.i("parse", day);
Log.i("parse", water);
Log.i("parse", excercise);
Log.i("parse", tonguescrape);
Log.i("parse", meditation);
Log.i("parse", journal);
Log.i("parse", dryskinbrush);
Log.i("parse", oilpull);
Log.i("parse", smoothie);
Log.i("parse", supplements);
Log.i("parse", tulsitee);
Log.i("parse", water2);
}
entity.consumeContent();
}
catch(Exception ex)
{
ex.toString();
Log.i("parse", ex.toString());
}
}
});
thread.start();
1
solved Android how to get data of following json [closed]