When JSONObject contains JSONArray, JSONArray's object can not be validated
Endwas opened this issue · comments
Endwas commented
like this
JSONObject jsonObject = new JSONObject();
jsonObject.put("v1", "v1");
JSONArray array = new JSONArray();
//wrong
JSONObject object2 = new JSONObject();
object2.put("o", "o2");
array.add(object2);
//right
JSONObject object1 = new JSONObject();
object1.put("o", 123);
array.add(object1);
jsonObject.put("array", array);
isSuccess = false.
JSONObject jsonObject = new JSONObject();
jsonObject.put("v1", "v1");
JSONArray array = new JSONArray();
//right
JSONObject object1 = new JSONObject();
object1.put("o", 123);
array.add(object1);
//wrong
JSONObject object2 = new JSONObject();
object2.put("o", "o2");
array.add(object2);
jsonObject.put("array", array);
isSuccess = right