java-json-tools / json-schema-validator

A JSON Schema validation implementation in pure Java, which aims for correctness and performance, in that order

Home Page:http://json-schema-validator.herokuapp.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Endwas opened this issue · comments

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