i've got a problem to retrieve information by a JSON
The Raw Json is this
{"date":"{\"yesterday\":\"Wed 28\",\"today\":\"Thu 29\",\"tomorrow\":\"Fri 30\"}"
Now how i could take this Json and format in this?
{
"date":{
"yesterday":"Wed 28",
"today":"Thu 29",
"tomorrow":"Fri 30"
}
}
And then retry the date from the key?
String jsonStr = sh.makeServiceCall(url);
Log.e("RAW-JSON: ","Retrieve RAW-Json is "+jsonStr);
if (jsonStr != null) {
try {
JSONObject jsonObj = new JSONObject(jsonStr);
JSONArray DATESTRING = jsonObj.getJSONArray("date");
JSONObject d = DATESTRING.getJSONObject(0);
String Ieri = d.getString("yesterday");
Log.e("DATE-JSON", "Retrieve DATE-Json is " + yesterday);
} catch (JSONException e) {
Log.e("ERROR", "Not a good result.");
e.printStackTrace();
}
}