JsonSchemaFactory jsonSchemaFactory = JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V202012);

    SchemaValidatorsConfig schemaValidatorsConfig = new SchemaValidatorsConfig ();

    //schemaValidatorsConfig.setFailFast(true);
    schemaValidatorsConfig.setHandleNullableField(true);
    schemaValidatorsConfig.setTypeLoose(false);

    //build json schema node
    JsonNode schemaNode;
    try {
        schemaNode = objectMapper.valueToTree(schema);
        
    } catch (Exception e) {
        
    }
    
    //build input json node
    JsonNode jsonNode;
    try {
        jsonNode = objectMapper.readTree(json);
    } catch (IOException e) {
        
    }
    
    //validate the json with the schema
    Set<ValidationMessage> validationErrors;
    
    JsonSchema jsonSchema = jsonSchemaFactory.getSchema(schemaNode, schemaValidatorsConfig);
    
    validationErrors = jsonSchema.validate(jsonNode);
Answer from Marian on Stack Overflow
🌐
GitHub
github.com › networknt › json-schema-validator
GitHub - networknt/json-schema-validator: A fast Java JSON schema validator that supports draft V4, V6, V7, V2019-09 and V2020-12 · GitHub
dependencies { implementation(group: 'com.networknt', name: 'json-schema-validator', version: '3.0.1'); } The following example demonstrates how inputs are validated against a schema.
Starred by 1K users
Forked by 338 users
Languages   Java 98.6% | Python 1.4%
🌐
GitHub
github.com › networknt › json-schema-validator › blob › master › doc › quickstart.md
json-schema-validator/doc/quickstart.md at master · networknt/json-schema-validator
*/ Schema schemaFromSchemaLocation = schemaRegistry .getSchema(SchemaLocation.of("https://www.example.com/schema/example-ref.json")); /* * By default all schemas are preloaded eagerly but ref resolve failures are not * thrown. You check if there are issues with ref resolving using * initializeValidators() */ schemaFromSchemaLocation.initializeValidators(); List<Error> errors = schemaFromSchemaLocation.validate("{\"id\": \"2\"}", InputFormat.JSON, executionContext -> executionContext .executionConfig(executionConfig -> executionConfig.formatAssertionsEnabled(true))); assertEquals(1, errors.size()); } @Test void schemaFromClasspath() { SchemaRegistry schemaRegistry = SchemaRegistry.withDefaultDialect(SpecificationVersion.DRAFT_2020_12); /* * This should be cached for performance.
Author   networknt
🌐
Maven Repository
mvnrepository.com › artifact › com.networknt › json-schema-validator
Maven Repository: com.networknt » json-schema-validator
2 weeks ago - HomePage https://github.com/networknt/json-schema-validator 🔍 Inspect URL · Links · 153 versions → · Central (140) Redhat GA (13) 153 versions → · Central · Atlassian External · Atlassian · WSO2 Releases · WSO2 Public · Hortonworks · KtorEAP · Mulesoft · JCenter · Sonatype · 🌐 · DNS Gurus · Free DNS Tools & Analysis · aar android apache api arm assets build build-system bundle client clojure cloud config cran data database eclipse example extension framework github gradle groovy io ios javascript jvm kotlin library logging maven mobile module npm osgi persistence plugin resources rlang sdk server service spring sql starter testing tools ui web webapp ·
🌐
Networknt
networknt.com › style › light-rest-4j › schema-validation
Schema Validation - Light-4j
October 19, 2021 - https://github.com/networknt/json-schema-validator · openapi-parse is a library to parse the OpenAPI 3.0 specification and prepare it with an internal structure to assist validation and security of the light-4j server. This library can resolve the $ref in the same specification—for example, all ...
🌐
DeepWiki
deepwiki.com › networknt › json-schema-validator › 9.2-usage-examples
Usage Examples | networknt/json-schema-validator | DeepWiki
May 17, 2025 - This page provides practical examples demonstrating how to use the JSON Schema Validator library. It covers various usage scenarios including schema loading, validation, configuration, and error handl
🌐
DeepWiki
deepwiki.com › networknt › json-schema-validator › 1.2-quick-start-guide
Quick Start Guide | networknt/json-schema-validator | DeepWiki
May 17, 2025 - Sources: doc/quickstart.md1-142 src/test/java/com/networknt/schema/SampleTest.java19-124 · Once you have loaded a schema, you can validate JSON data against it:
🌐
Maven Central
central.sonatype.com › artifact › com.networknt › json-schema-validator
com.networknt:json-schema-validator - Maven Central
--> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" > <modelVersion>4.0.0</modelVersion> <groupId>com.networknt</groupId> <artifactId>json-schema-validator</artifactId> <version>3.0.1</version> <packaging>bundle</packaging> <name>JsonSchemaValidator</name> <description>A json schema validator that supports draft v4, v6, v7, v2019-09 and v2020-12</description> <url>https://github.com/networknt/json-schema-validator</url> <licenses> <license
🌐
Javadoc.io
javadoc.io › doc › com.networknt › json-schema-validator › 1.0.12 › com › networknt › schema › JsonSchema.html
JsonSchema - json-schema-validator 1.0.12 javadoc
Latest version of com.networknt:json-schema-validator · https://javadoc.io/doc/com.networknt/json-schema-validator · Current version 1.0.12 · https://javadoc.io/doc/com.networknt/json-schema-validator/1.0.12 · package-list path (used for javadoc generation -link option) https://javadoc...
Find elsewhere
🌐
Maven Central
central.sonatype.com › artifact › com.networknt › json-schema-validator › 1.0.83
com.networknt:json-schema-validator:1.0.83 - Maven Central
--> <project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" > <modelVersion>4.0.0</modelVersion> <groupId>com.networknt</groupId> <artifactId>json-schema-validator</artifactId> <version>1.0.83</version> <packaging>bundle</packaging> <name>JsonSchemaValidator</name> <description>A json schema validator that supports draft v4, v6, v7, v2019-09 and v2020-12</description> <url>https://github.com/networknt/json-schema-validator</url> <licenses> <lic
🌐
MS Charhag
mscharhag.com › java › json-schema-validation
JSON Schema validation in Java - Michael Scharhag
July 23, 2020 - This makes it easy to integrate JSON Schema validation in Spring (hint: upcoming blog post). We need to add the following dependency to our project: <dependency> <groupId>com.networknt</groupId> <artifactId>json-schema-validator</artifactId> <version>1.0.42</version> </dependency>
🌐
Javadoc.io
javadoc.io › doc › com.networknt › json-schema-validator › latest › index.html
json-schema-validator 3.0.1 javadoc (com.networknt)
Latest version of com.networknt:json-schema-validator · https://javadoc.io/doc/com.networknt/json-schema-validator · Current version 3.0.1 · https://javadoc.io/doc/com.networknt/json-schema-validator/3.0.1 · package-list path (used for javadoc generation -link option) https://javadoc.i...
🌐
GitHub
github.com › networknt › json-schema-validator › releases
Releases · networknt/json-schema-validator
A fast Java JSON schema validator that supports draft V4, V6, V7, V2019-09 and V2020-12 - networknt/json-schema-validator
Author   networknt
🌐
Amazon
developer-docs.amazon.com › sp-api › docs › product-type-definition-meta-schema-v1-example-java
Java Example of Meta-Schema v1
Validate payloads with Amazon Product Type Definitions meta-schema instances. For Java applications, the networknt/json-schema-validator library supports JSON Schema Draft 2019-09 and custom vocabularies. The following example demonstrates how to utilize the networknt/json-schema-validator library to validate payloads with instances of the Amazon Product Type Definition Meta-Schema.
🌐
DeepWiki
deepwiki.com › networknt › json-schema-validator › 8-configuration-and-customization
Configuration and Customization | networknt/json-schema-validator | DeepWiki
May 17, 2025 - The SchemaValidatorsConfig class contains numerous configuration options that control the validator's behavior. It uses a builder pattern for easy configuration. ... To use the configuration, create an instance using the builder pattern and pass it to the JsonSchemaFactory when creating a schema: Sources: doc/config.md27-35 src/test/java/com/networknt/schema/TypeValidatorTest.java177-180
🌐
GitHub
github.com › networknt › json-schema-validator › blob › master › doc › walkers.md
json-schema-validator/doc/walkers.md at master · networknt/json-schema-validator
Property walk listeners are called for every property defined in the JSON node data. Both property walk listeners and keyword walk listener can be modeled by using the same WalkListener interface. Following is an example of how to add a property walk listener. SchemaValidatorsConfig.Builder schemaValidatorsConfig = SchemaValidatorsConfig.builder(); schemaValidatorsConfig.propertyWalkListener(new ExamplePropertyWalkListener()); final JsonSchemaFactory schemaFactory = JsonSchemaFactory .builder(JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V201909)).metaSchema(metaSchema) .build(); this.jsonSchema = schemaFactory.getSchema(getSchema(), schemaValidatorsConfig.build());
Author   networknt
🌐
Baeldung
baeldung.com › home › json › introduction to json schema in java
Introduction to JSON Schema | Baeldung
November 27, 2024 - With our JSON Schema put in place, we can validate our JSON Object. There are many libraries to accomplish this task. For our example, we have chosen the Java json-schema library. First of all, we need to add the following dependency to our pom.xml: <dependency> <groupId>com.networknt</groupId> <artifactId>json-schema-validator</artifactId> <version>1.4.0</version> </dependency> Finally, we can write a couple of simple test cases to validate our JSON Object: @Test public void givenInvalidInput_whenValidating_thenInvalid() throws IOException { JsonSchemaFactory factory = JsonSchemaFactory.getIn
🌐
Medium
medium.com › @mohommad.belal › json-schema-validator-using-java-springboot-667ed42480d5
JSON Schema Validator using Java SpringBoot. | Medium
May 11, 2024 - But, sometimes the json is complex and not all fields can be validated using such constraints. Using JsonSchema it is possible to validate complex jsons using a standardized structure. This is a step-by-step guide for using Json Schema with SpringBoot. We will use networknt library to achieve this.