I am trying to send json to HTTP server with this JSON format:
{"deviceID":3852883413434, "depth":2,"location":{"xCord":46.232, "yCord":42.4421},"size":3}
and here is my code in android, but seems not working well.Maybe i need array for location or format my code.Any adivce could help thanks.
JSONObject postData = new JSONObject();
try {
postData.put("deviceID", unique_id);
postData.put("depth",((HoleSize)this.getApplication()).getDepth());
postData.put("xCord",((HoleSize)this.getApplication()).getLattitude());
postData.put("yCord",((HoleSize)this.getApplication()).getLongitude());
postData.put("size", ((HoleSize) this.getApplication()).getSize());
new SendData().execute("servername",postData.toString());
} catch (JSONException e) {
e.printStackTrace();
}