I create JsonObject
and JsonArray
as following:
JSONObject jObj = new JSONObject();
jObj.put("path", "dfds/g");
jObj.put("etag", "dfdsfsd");
jObj.put("size_bytes", 123);
JSONArray list = new JSONArray();
list.add(jObj);
String s = list.toJSONString();
The result I get:
[{"size_bytes":123,"etag":"dfdsfsd","path":"dfds\/g"}]
- I expect the path component to be
"path":"dfds\g"
, notdfds\/g
- I need the field to be in order as I they in the code, but they are not as I expected:
path, etag, size_bytes
I`ll be glad to get an advices how to solve the above issues