0
我要以这种格式如何发送JSON请求以这种格式
"coordinates":{"0":{"received_at":1471529314,"lat":28.6888798,"long":77.3247225}}
发送JSON请求,但我能够把请求发送这种格式
{"coordinates":{"0":{"received_at":1471529314,"lat":28.6888798,"long":77.3247225}}}
我使用这个代码
jsonObject.put("received_at", now);
jsonObject.put("lat", latitude);
jsonObject.put("long", longitude);
JSONObject json = new JSONObject();
json.put("0",jsonObject);
jsonObject1 = new JSONObject();
jsonObject1.put("coordinates",json);
Log.e("JSON",jsonObject1.toString());
是在除去第一,唯一的区别和最后支架? –
是的括号只是区别@MuratK。 –