Writing JSON request in android

view story

http://stackoverflow.com – I have a Json request and I need to create the request and post it to server. The request look like this "slice": [{ "departure": { "airport": { "code": "ATL" }, "date": "2013-05-11" }, "arrival": { "airport": { "code": "LAX" } } }] I created the String using JSON writer, but getting an exception. departure.put("date", "2013-05-11"); departure.put("departure",airport); //departure.put("airport", airport); airport.put("airport", code); code.put("code","ATL"); //json.put("departure", departure); arrival.put (HowTos)