Giter Site home page Giter Site logo

java.lang.ClassCastException: class org.json.JSONObject$Null cannot be cast to class java.lang.String (org.json.JSONObject$Null is in unnamed module of loader 'app'; java.lang.String is in module java.base of loader 'bootstrap') about json-schema HOT 3 CLOSED

mpet avatar mpet commented on August 30, 2024
java.lang.ClassCastException: class org.json.JSONObject$Null cannot be cast to class java.lang.String (org.json.JSONObject$Null is in unnamed module of loader 'app'; java.lang.String is in module java.base of loader 'bootstrap')

from json-schema.

Comments (3)

erosb avatar erosb commented on August 30, 2024

Hello, it seems your schema json goes through plenty of transformations, and somewhere a "$schema":null property is added, on which the exception is thrown (which is quite reasonable, since the value of $schema must be a string.

Maybe after this line JSONObject jsonSchema = new JSONObject(new JSONTokener(schemaNode.toString())); you could remove it programmatically, like jsonSchema.remove("$schema"); so that the SchemaLoader receives a clean input.

from json-schema.

mpet avatar mpet commented on August 30, 2024

Hello,
Thanks for reply. Seems like I have null for others too. Do you know the reason for these null?

from json-schema.

erosb avatar erosb commented on August 30, 2024

I don't know, since it gets added before the validator library is called.

from json-schema.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.