I have a jSON response from google directions API in the form of a string. How do I fetch the "maneuver" object from this? I want to place it inside another JSON array which I will later turn into a string.
Here is what I have done till now:
public JSONArray parseDirectionsForNavigation(String jsonData)
{
JSONArray jsonArray_live = null;
JSONObject jsonObject_live;
try {
jsonObject_live = new JSONObject(jsonData);
jsonArray_live = jsonObject_live.getJSONArray("routes").getJSONObject(0).getJSONArray("legs").getJSONObject(0).getJSONArray("steps");
} catch (JSONException e) {
e.printStackTrace();
}
return jsonArray_live;
}