I am trying to write inner follow by inner2 then inner3. However, right now it is inner2, inner3 then inner1. How can I write JSON object to go according to the sequence i want?
public void toJSON(String description, String Name)
{
JSONObject inner = new JSONObject();
JSONObject inner2= new JSONObject();
JSONObject inner3= new JSONObject();
try {
outer.put("DATA 1", inner);
inner.put("description", description);
inner.put("filename", imageName);
outer.put("DATA 2", inner2);
inner2.put("model", "modelname");
outer.put("Datetime", inner3);
inner3.put("Datetime", "DateTime");
} catch (JSONException ex) {
ex.printStackTrace();
}
}