Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When JSONObject contains JSONArray, JSONArray's object can not be validated #399

Open
Endwas opened this issue Jul 25, 2022 · 0 comments
Open

Comments

@Endwas
Copy link

Endwas commented Jul 25, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant