Skip to content

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

@Endwas

Description

@Endwas

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Endwas

        Issue actions

          When JSONObject contains JSONArray, JSONArray's object can not be validated · Issue #399 · java-json-tools/json-schema-validator