JSON Schema applied to InterSystems IRIS
Tags: json, javascript, java, programming
Published: 2023-09-28 20:15:54

The JSON is a data document free of types and validation rules. However, in some scenarios it is important that the JSON document has type and business rules validation, especially in interoperability scenarios. This article demonstrates how you can leverage a market-defined JSONSchema technology that is open for everyone to use and do advanced validations.

## About JSON

According to json.org, “JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language Standard ECMA-262 3rd Edition - December 1999. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language”. (Source: https://www.json.org/json-en.html). An example of a JSON document could be:

  
<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Calibri,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"><span style="border:none"><span style="display:inline-block"><span style="overflow:hidden"><span style="width:246px"><span style="height:243px"><img src="https://lh6.googleusercontent.com/hSw7A2wqdk1Peqxr51c_PKWmcm5JqQEd7FHgkLCYBl8lJBcLnzh3SVUgdrORwvxiDkDYpCdUB7wX_L6qGlwVwfHxbkGiC7zkt127P82Uc4a6Bs0Zhmp8I2zDtQ6HfFY205GB0GDC6zAEcdBWuTE" /></span></span></span></span></span></span></span></span></span></span></span>

## About JSON Schema

According to json-schema.org, “JSON Schema is a vocabulary that allows you to annotate and validate JSON documents.”.  
If JSON is easy for humans to read, write and understand, why do we need to apply a schema to validate JSON documents/content? The main reasons are:

  1. To define a clear contract to interoperate JSON based data between partners and their applications.
  2. To detail, document and describe your JSON files, making it easier to use.
  3. To validate JSON data for automated testing, ensuring the quality of the requests and responses.
  4. To generate JSON sample and/or real data from the JSON Schema.
  5. To apply business/validation rules into JSON content, instead of creating language dependent validations.
  6. To support the “contract first approach” on the development of REST API. More details on https://swagger.io/blog/api-design/design-first-or-code-first-api-development/.

## JSON Syntax

To understand the role of JSON Schema in a JSON game, it is necessary to know more about JSON syntax. The JSON syntax is derived from JavaScript object notation syntax, so, the syntax rules are equal to JavaScript objects. The JSON rules are next (source: https://www.w3schools.com/js/js\_json\_syntax.asp):


1.Data must be specified in name/value pairs. 
2.Data must be separated by commas. 
3.Curly braces hold objects. 
4.Square brackets hold arrays.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/21kskjfj0j8u1mbk4sk3.png)

The JSON Data consists of a name/value pair with a field name (in double quotes), followed by a colon and followed by a value. Example:

<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Calibri,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"><span style="border:none"><span style="display:inline-block"><span style="overflow:hidden"><span style="width:174px"><span style="height:23px"><img src="https://lh6.googleusercontent.com/n2JCTFGKwvYZ41dHaN6DRkwNCfghFY8JthyCOx8fIqQYNmQk1vzHwBO9cJmXDb6X9eJAxdUwkKIklk-Ozf-vsg2n45lP6Sag2o4PPKLEd2-0bpYIIT9afm7416hL4gQWu9CLv2IzQgpCt9QCk4E" /></span></span></span></span></span></span></span></span></span></span></span>

JSON names require double quotes and refers to JavaScript objects and to InterSystems IRIS ObjectScript Dynamic Object (%Library.DynamicObject) too. More details in https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls?KEY=GJSON\_intro#GJSON\_intro_methods.

In JSON, values must be one of the following data types:

  * A string, must be between “”. Sample: “a string”.
  * A number, must be integer or decimal values. Sample: 10 or 20.23.
  * An object, must be between {}. Sample: {“firstName”: “John”}.
  * An array, must be between []. Sample: [{“firstName: “John”},{“firstName”: “Anna”}].
  * A Boolean, must be true or false. Sample: {“isDead”: false}.
  * A null, to set no value.

When you apply a JSON document to a language object, these syntax rules are validated, but sometimes, it is necessary to establish business rules too. JSON Schema is used for this, to expand JSON basic rules with rules specified in JSON Schema documents.  
The InterSystems IRIS has full support for JSON basic rules, and JSON content is very elegant to read or write.. It is easier than any other programming language, see a sample:

| InterSystems IRIS Object Script writing JSON                                                                                                                                                                                                                                       | Java writing JSON                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| set dynObject1 = ##class(%DynamicObject).%New()set dynObject1.SomeNumber = 42set dynObject1.SomeString = "a string"set dynObject1.SomeArray = ##class(%DynamicArray).%New()set dynObject1.SomeArray."0" = "an array element"set dynObject1.SomeArray."1" = 123dynObject1.%ToJSON() |   //First EmployeeJSONObject employeeDetails = new JSONObject();employeeDetails.put("firstName","Lokesh");employeeDetails.put("lastName", "Gupta");employeeDetails.put("website","howtodoinjava.com");JSONObject employeeObject = new JSONObject(); employeeObject.put("employee", employeeDetails); //Second EmployeeJSONObject employeeDetails2 = new JSONObject();employeeDetails2.put("firstName", "Brian");employeeDetails2.put("lastName", "Schultz");employeeDetails2.put("website", "example.com"); JSONObject employeeObject2 = new JSONObject(); employeeObject2.put("employee", employeeDetails2); //Add employees to listJSONArray employeeList = new JSONArray();employeeList.add(employeeObject);employeeList.add(employeeObject2);employeeList.toJSONString(); |

While ObjectScript is a dynamic language, allowing setting JSON properties as object properties, other languages, like Java, force you to set key and values inside objects. On the other hand, Java and other languages support JSON Schema using open source and commercial packages, but the ObjectScript does not support  JSON Schema at the moment. See the list from json-schema.org (source: https://json-schema.org/implementations.html):

**NET**

  * Json.NET Schema 2019-09, draft-07, -06, -04, -03 (AGPL-3.0-only)
  * JsonSchema.Net 2020-12, 2019-09, draft-07, -06 (MIT)

**C++**

  * f5-json-schema draft-07 (Boost Software License 1.0)
  * JSON schema validator for JSON for Modern C++ draft-07 (MIT)
  * Valijson draft-07 header-only library, works with many JSON parser implementations (BSD-2-Clause)
  * Jsoncons draft-07 header-only library (Boost Software License 1.0)

**Java**

  * Snow 2019-09, draft-07, -06 Uses Maven for the project and Gson under the hood. (GNU Affero General Public License v3.0)
  * Vert.x Json Schema 2019-09, draft-07 includes custom keywords support, custom dialect support, asynchronous validation (Apache License, Version 2.0)
  * Everit-org/json-schema draft-07, -06, -04 (Apache License 2.0)
  * Justify draft-07, -06, -04 (Apache License 2.0)
  * Networknt/json-schema-validator draft-07, -06, -04 Support OpenAPI 3.0 with Jackson parser (Apache License 2.0)
  * Jsonschemafriend 2019-09, draft-07, -06, -04, -03 (Apache License 2.0)

**JavaScript**

  * Ajv 2019-09, 2020-12, draft-07, -06, -04 for Node.js and browsers - supports user-defined keywords and $data reference (MIT)
  * Djv draft-06, -04 for Node.js and browsers (MIT)
  * Hyperjump JSV 2019-09, 2020-12, draft-07, -06, -04 Built for Node.js and browsers. Includes support for custom vocabularies. (MIT)
  * Vue-vuelidate-jsonschema draft-06 (MIT)
  * @cfworker/json-schema 2019-09, draft-07, -06, -04 Built for Cloudflare workers, browsers, and Node.js (MIT)

**Python**

  * jschon 2019-09, 2020-12 (MIT)
  * jsonschema 2019-09, 2020-12, draft-07, -06, -04, -03 (MIT)
  * fastjsonschema draft-07, -06, -04 Great performance thanks to code generation. (BSD-3-Clause)
  * jsonschema-rs draft-07, -06, -04 Python bindings to Rust’s jsonschema crate (MIT) <span> </span>

This is a sample how to use JSON schema to validate JSON content (using Python, source: https://jschon.readthedocs.io/en/latest/):

  
<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Calibri,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"><span style="border:none"><span style="display:inline-block"><span style="overflow:hidden"><span style="width:566px"><span style="height:337px"><img src="https://lh3.googleusercontent.com/8BDf2-6f1UYTVzAQbUuqh7ePNVLskRaLdDgt4GPLy6XSCZXF9TlZbbpFK6q5HSvOdCdBUyU3AKDGs1NLf1-BPvKAJ--wKms5gMsF0jEWWKY9j08QpzEKE1Ow1zf9YRnDzo0e7YXNE0JLnirRisA" /></span></span></span></span></span></span></span></span></span></span></span>

  
<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Calibri,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"><span style="border:none"><span style="display:inline-block"><span style="overflow:hidden"><span style="width:566px"><span style="height:107px"><img src="https://lh5.googleusercontent.com/LDNFboND9YaDdIBustcb-1BxgfshIEfgkSzQz0SJDZxg4FInP7f5YV-HcD00Ih4WNGgtGid8kevsnAZZ7qqofr0SK90AtFHXEzXVcGB3vQL_3ewKvaW_Wnur7kXAYSWdfHHe5619C1HmVtEaq7M" /></span></span></span></span></span></span></span></span></span></span></span>

  
<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Calibri,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"><span style="border:none"><span style="display:inline-block"><span style="overflow:hidden"><span style="width:567px"><span style="height:382px"><img src="https://lh6.googleusercontent.com/7RyvqX4uqLcTkmdwltQgHrnlucoy85alkcY4nrh10u-Ky8jU4UQkz9pTCuvuMvNFFFEFn3ZebUl86Oe4BdwufH4pk4MEf5jhaUsO8cBJUPg54LQ10vYy7Z9c3VBd37DVOUEuukeTe_irHjLGtbk" /></span></span></span></span></span></span></span></span></span></span></span>

Fortunately, IRIS allows you to create packages or frameworks using the programming language of your choice (.NET or Java using PEX or Language Server). So, it is possible to create an IRIS extension package to handle JSON Schema in IRIS. Another possibility is to use Embedded Python and create a JSON validation method class (in the version 2021.2+).

## Extending the InterSystems IRIS to support JSON Schema using Java Language Server (Java Gateway)

Among Java frameworks, the networknt/json-schema-validator is used the most to validate JSON using JSON Schema.  
To use this Java framework, you can get the application https://openexchange.intersystems.com/package/IRIS-JSON-Schema-Validator. This application has the following files and folders:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a3jrewuo8qcheahddh0c.png)

1. The folder jgw has the necessary files to create a Java Gateway (bridge to allow communication between Java and IRIS classes); 
2. The iris-json-schema-1.0.0.jar has the Java classes and libraries (including json-schema-validator) to service JSON Schema validations; 
3. The JSONSchemaValidator.cls has the ObjectScript code to use the Java class and do JSON validations using JSON schema by the validation rules; 
4. The Dockerfile and docker-compose.yml run the Java Gateway and the IRIS as docker instances.


The Java Class has a validation method, which uses the framework json-schema-validator to validate the JSON Schema and the JSON, and to return the validation results. See the Java Code:

<div class="spoiler">
  <div class="spoiler-title">
    <div class="spoiler-toggle hide-icon">
       
    </div> Java Class for JSON Schema Validation
  </div>
  
  <div class="spoiler-content">
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#7f0055"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">package</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> dc.irisjsonschema;</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#7f0055"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">import</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> java.io.BufferedReader;</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#7f0055"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">import</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> java.io.IOException;</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#7f0055"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">import</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> java.io.InputStream;</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#7f0055"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">import</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> java.io.InputStreamReader;</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#7f0055"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">import</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> java.util.Set;</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#7f0055"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">import</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> java.util.stream.Collectors;</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#7f0055"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">import</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> com.fasterxml.jackson.core.JsonProcessingException;</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#7f0055"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">import</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> com.fasterxml.jackson.databind.JsonNode;</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#7f0055"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">import</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> com.fasterxml.jackson.databind.ObjectMapper;</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#7f0055"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">import</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> com.networknt.schema.JsonSchema;</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#7f0055"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">import</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> com.networknt.schema.JsonSchemaFactory;</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#7f0055"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">import</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> com.networknt.schema.SpecVersion;</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#7f0055"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">import</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> com.networknt.schema.ValidationMessage;</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#7f0055"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">public</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#7f0055"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">class</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> JSONSchemaService {</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">  </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#7f0055"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">public</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> String validate(String </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#6a3e3e"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">jsonSchemaContent</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">, String </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#6a3e3e"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">jsonContent</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">) {</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">    </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#3f7f5f"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">// create instance of the ObjectMapper class</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">    ObjectMapper </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#6a3e3e"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">objectMapper</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> = </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#7f0055"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">new</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> ObjectMapper();</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">    </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#3f7f5f"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">// create an instance of the JsonSchemaFactory using version flag</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">    JsonSchemaFactory </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#6a3e3e"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">schemaFactory</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> = JsonSchemaFactory.</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:italic"><span style="text-decoration:none">getInstance</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">(SpecVersion.VersionFlag.</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#0000c0"><span style="font-weight:700"><span style="font-style:italic"><span style="text-decoration:none">V201909</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">);</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">    </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#7f0055"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">try</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> {</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">    </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">  </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#3f7f5f"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">// read data from the stream and store it into JsonNode</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">    </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">  JsonNode </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#6a3e3e"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">json</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> = </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#6a3e3e"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">objectMapper</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">.readTree(</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#6a3e3e"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">jsonContent</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">);</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">    </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">  </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#3f7f5f"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">// get schema from the schemaStream and store it into JsonSchema</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">    </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">  JsonSchema </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#6a3e3e"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">schema</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> = </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#6a3e3e"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">schemaFactory</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">.getSchema(</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#6a3e3e"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">jsonSchemaContent</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">);</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">    </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">  </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#3f7f5f"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">// create set of validation message and store result in it</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">    </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">  Set&lt;ValidationMessage> </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#6a3e3e"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">validationResult</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> = </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#6a3e3e"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">schema</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">.validate(</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#6a3e3e"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">json</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">);   </span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">    </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">  </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#7f0055"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">if</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">(</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#6a3e3e"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">validationResult</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">.isEmpty()) {</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">    </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">    </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#7f0055"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">return</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#2a00ff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">"{\"message\": \"JSON is valid\", \"valid\":true}"</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">;</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">    </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">  } </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#7f0055"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">else</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> {</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2; text-indent:35.4pt">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">    </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#7f0055"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">return</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#2a00ff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">"{\"message\": \""</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> + </span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2; margin-left:47px; text-indent:35.4pt">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#6a3e3e"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">validationResult</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">.toString()  + </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#2a00ff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">"\", \"valid\":false}"</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">;</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">    </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">  }</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">    </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">    </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">    </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">      } </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#7f0055"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">catch</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> (JsonProcessingException </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#6a3e3e"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">e</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">) {</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">    </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">  </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#7f0055"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">return</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#6a3e3e"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">e</span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">.getMessage();</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">      } </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">    </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">    </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">    </span></span></span></span></span></span><span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">    </span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">  }</span></span></span></span></span></span>
    </p>
    
    <p style="line-height:1.2">
      <span style="font-size:9pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">}</span></span></span></span></span></span>
    </p>
  </div>
</div>

The InterSystems IRIS uses this Java validation method to validate JSON content. To do that it is necessary to create a JAR file with the validate class inside (iris-json-schema-1.0.0.jar) and to configure a Java Gateway (bridge between Java and IRIS communication), allowing ObjectScript to call the Java methods.  
The ObjectScript code which uses the Java Class and the JSONSchemaValidator class is presented here:

<div class="spoiler">
  <div class="spoiler-title">
    <div class="spoiler-toggle hide-icon">
       
    </div> Final Java Class read to Validate JSON inside IRIS
  </div>
  
  <div class="spoiler-content">
    <div style="color: #d4d4d4;background-color: #1e1e1e;font-family: Consolas, 'Courier New', monospace;font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;">
      <div>
        <span style="color: #80bd66;">///</span><span style="color: #6a9955;"> </span><span style="color: #80bd66;">Validate JSON documents using JSON Schema documents</span>
      </div>
      
      <div>
        <span style="color: #85a6ff;">Class</span><span style="color: #d4d4d4;"> </span><span style="color: #4ec9b0;">dc</span><span style="color: #4ec9b0;">.</span><span style="color: #4ec9b0;">irisjsonschema</span><span style="color: #4ec9b0;">.</span><span style="color: #4ec9b0;">JSONSchemaValidator</span>
      </div>
      
      <div>
        <span style="color: #ffffff;">{</span>
      </div>   
      
      <div>
        <span style="color: #80bd66;">///</span><span style="color: #6a9955;"> </span><span style="color: #80bd66;">Get json and json schema em return validation results</span>
      </div>
      
      <div>
        <span style="color: #85a6ff;">ClassMethod</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">Validate</span><span style="color: #ffffff;">(</span><span style="color: #ff75f4;">JSONSchemaContent</span><span style="color: #d4d4d4;"> </span><span style="color: #85a6ff;">As</span><span style="color: #d4d4d4;"> </span><span style="color: #4ec9b0;">%String</span><span style="color: #ffffff;">,</span><span style="color: #d4d4d4;"> </span><span style="color: #ff75f4;">JSONContent</span><span style="color: #d4d4d4;"> </span><span style="color: #85a6ff;">As</span><span style="color: #d4d4d4;"> </span><span style="color: #4ec9b0;">%String</span><span style="color: #ffffff;">,</span><span style="color: #d4d4d4;"> </span><span style="color: #85a6ff;">Output</span><span style="color: #d4d4d4;"> </span><span style="color: #ff75f4;">ValidationResult</span><span style="color: #d4d4d4;"> </span><span style="color: #85a6ff;">As</span><span style="color: #d4d4d4;"> </span><span style="color: #4ec9b0;">%String</span><span style="color: #ffffff;">)</span><span style="color: #d4d4d4;"> </span><span style="color: #85a6ff;">As</span><span style="color: #d4d4d4;"> </span><span style="color: #4ec9b0;">%Status</span>
      </div>
      
      <div>
        <span style="color: #ffffff;">{</span>
      </div>
      
      <div>
        <span style="color: #d4d4d4;">    </span><span style="color: #ffffff;">Set</span><span style="color: #d4d4d4;"> </span><span style="color: #ade2ff;">sc</span><span style="color: #d4d4d4;"> </span><span style="color: #ffffff;">=</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">$$$</span><span style="color: #dcdcaa;">OK</span>
      </div>   
      
      <div>
        <span style="color: #6a9955;">    </span><span style="color: #80bd66;">// Connect a Gateway instance to server JavaGateway on the host machine</span>
      </div>
      
      <div>
        <span style="color: #d4d4d4;">    </span><span style="color: #ffffff;">set</span><span style="color: #d4d4d4;"> </span><span style="color: #ade2ff;">GW</span><span style="color: #d4d4d4;"> </span><span style="color: #ffffff;">=</span><span style="color: #d4d4d4;"> </span><span style="color: #85a6ff;">##class</span><span style="color: #ffffff;">(</span><span style="color: #4ec9b0;">%Net</span><span style="color: #4ec9b0;">.</span><span style="color: #4ec9b0;">Remote</span><span style="color: #4ec9b0;">.</span><span style="color: #4ec9b0;">Gateway</span><span style="color: #ffffff;">)</span><span style="color: #ffffff;">.</span><span style="color: #dcdcaa;">%New</span><span style="color: #ffffff;">(</span><span style="color: #ffffff;">)</span>
      </div>
      
      <div>
        <span style="color: #d4d4d4;">    </span><span style="color: #ffffff;">set</span><span style="color: #d4d4d4;"> </span><span style="color: #ade2ff;">st</span><span style="color: #d4d4d4;"> </span><span style="color: #ffffff;">=</span><span style="color: #d4d4d4;"> </span><span style="color: #ade2ff;">GW</span><span style="color: #ffffff;">.</span><span style="color: #dcdcaa;">%Connect</span><span style="color: #ffffff;">(</span><span style="color: #d4b57c;">"jgw"</span><span style="color: #ffffff;">,</span><span style="color: #d4d4d4;"> </span><span style="color: #d4b57c;">"55555"</span><span style="color: #ffffff;">,</span><span style="color: #d4d4d4;"> </span><span style="color: #d4b57c;">"IRISAPP"</span><span style="color: #ffffff;">,</span><span style="color: #ffffff;">,</span><span style="color: #ffffff;">)</span><span style="color: #d4d4d4;"> </span>
      </div>
      
      <div>
        <span style="color: #6a9955;">    </span><span style="color: #80bd66;">//instantiate java class</span>
      </div>
      
      <div>
        <span style="color: #d4d4d4;">    </span><span style="color: #ffffff;">set</span><span style="color: #d4d4d4;"> </span><span style="color: #ade2ff;">JSONSchemaValidator</span><span style="color: #d4d4d4;"> </span><span style="color: #ffffff;">=</span><span style="color: #d4d4d4;"> </span><span style="color: #85a6ff;">##class</span><span style="color: #ffffff;">(</span><span style="color: #4ec9b0;">%Net</span><span style="color: #4ec9b0;">.</span><span style="color: #4ec9b0;">Remote</span><span style="color: #4ec9b0;">.</span><span style="color: #4ec9b0;">Object</span><span style="color: #ffffff;">)</span><span style="color: #ffffff;">.</span><span style="color: #dcdcaa;">%New</span><span style="color: #ffffff;">(</span><span style="color: #ade2ff;">GW</span><span style="color: #ffffff;">,</span><span style="color: #d4b57c;">"dc.irisjsonschema.JSONSchemaService"</span><span style="color: #ffffff;">)</span>
      </div>
      
      <div>
        <span style="color: #6a9955;">    </span><span style="color: #80bd66;">//validate the JSON using a JSON Schema</span>
      </div>
      
      <div>
        <span style="color: #d4d4d4;">    </span><span style="color: #ffffff;">set</span><span style="color: #d4d4d4;"> </span><span style="color: #ff75f4;">ValidationResult</span><span style="color: #d4d4d4;"> </span><span style="color: #ffffff;">=</span><span style="color: #d4d4d4;"> </span><span style="color: #ade2ff;">JSONSchemaValidator</span><span style="color: #ffffff;">.</span><span style="color: #dcdcaa;">validate</span><span style="color: #ffffff;">(</span><span style="color: #ff75f4;">JSONSchemaContent</span><span style="color: #ffffff;">,</span><span style="color: #d4d4d4;"> </span><span style="color: #ff75f4;">JSONContent</span><span style="color: #ffffff;">)</span>
      </div>
      
      <div>
        <span style="color: #d4d4d4;">    </span>
      </div>
      
      <div>
        <span style="color: #d4d4d4;">    </span><span style="color: #ffffff;">Write</span><span style="color: #d4d4d4;"> </span><span style="color: #ff75f4;">ValidationResult</span>
      </div>   
      
      <div>
        <span style="color: #d4d4d4;">    </span><span style="color: #ffffff;">Return</span><span style="color: #d4d4d4;"> </span><span style="color: #ade2ff;">sc</span>
      </div>
      
      <div>
        <span style="color: #ffffff;">}</span>
      </div>
    </div>
  </div>
</div>

With this ObjectScript class and the Validate class method, it is possible to use any JSON content and any JSON Schema definition to validate basic and advanced validation rules.  
To see this, execute these steps:

1. Go to https://openexchange.intersystems.com/package/IRIS-JSON-Schema-Validator

2. Git-clone the repository into any local directory

<pre>$ git clone https://github.com/yurimarx/iris-json-schema.git</pre>

3. Open the terminal in this directory and run it:

<pre>$ docker-compose build</pre>

4. Run the IRIS container with your project:

<pre>$ docker-compose up</pre>

5. Go to the IRIS terminal (open a new VSCode Terminal)

<pre>docker exec -it iris-json-schema_iris_1  bash iris session iris</pre>

6. Change to the IRISAPP namespace

<pre>set $namespace = "IRISAPP"</pre>

7. Get a sample JSON Schema

<pre>set jsonSchema = ##class(dc.irisjsonschema.JSONSchemaValidator).GetJSONSchema()</pre>

8. Get a sample valid JSON

<pre>set jsonContent = ##class(dc.irisjsonschema.JSONSchemaValidator).GetValidSampleJSON()</pre>

9. Get a validation equals to valid

<pre>set st = ##class(dc.irisjsonschema.JSONSchemaValidator).Validate(jsonSchema,jsonContent,.result)
write result</pre>

10. Now, get a sample INVALID JSON

<pre>set jsonContent =   ##class(dc.irisjsonschema.JSONSchemaValidator).GetInvalidSampleJSON()</pre>

11. After that, get validation equals to INVALID  

<pre>set st = ##class(dc.irisjsonschema.JSONSchemaValidator).Validate(jsonSchema,jsonContent,.result)
write result</pre>

12. The JSON Schema used was:

<div class="spoiler">
  <div class="spoiler-title">
    <div class="spoiler-toggle hide-icon">
       
    </div> JSON Schema used to define the validation rules
  </div>
  
  <div class="spoiler-content">
    {<br />    "$schema": "https://json-schema.org/draft/2019-09/schema#",<br />    "type": "object",<br />    "title": "Movie art",<br />    "description": "Information about actors",<br />    "additionalProperties": true,<br />  <strong>  "required": [<br />        "name",<br />        "artist",<br />        "description",<br />        "tags"<br />    ],</strong><br />    "properties": {<br />        "name": {<br />            "type": "string",<br />            "description": "Painting name"<br />        },<br />        "artist": {<br />            "type": "string",<br />            "maxLength": 50,<br />            "description": "Name of the artist"<br />        },<br />        "description": {<br />            "type": [<br />                "string",<br />                "null"<br />            ],<br />            "description": "Painting description"<br />        },<br />        "tags": {<br />            "type": "array",<br />            "items": {<br />                "$ref": "#/$defs/tag"<br />            }<br />        }<br />    },<br />    "$defs": {<br />        <strong>"tag": {<br />            "type": "string",<br />            "enum": [<br />                "action",<br />                "suspense",<br />                "UK",<br />                "famous",<br />                "license",<br />                "kill"<br />            ]</strong><br />        }<br />    }<br />}
  </div>
</div>

This JSON Schema configured the fields and the tags array with limited values (enum) as required.

The types of the JSON fields are defined too. So, for this schema the following JSON Object is valid:

<p style="line-height:1.295; background-color:#1e1e1e">
  <span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">set</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ade2ff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">obj</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">=</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">{}</span></span></span></span></span></span><br /><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">set</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ade2ff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">obj</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">.</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#dcdcaa"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">name</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">=</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4b57c"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">"Agent 007"</span></span></span></span></span></span><br /><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">set</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ade2ff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">obj</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">.</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#dcdcaa"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">artist</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">=</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4b57c"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">"Pierce Brosman"</span></span></span></span></span></span><br /><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">set</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ade2ff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">obj</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">.</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#dcdcaa"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">description</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">=</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4b57c"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">"007 actor"</span></span></span></span></span></span><br /><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">set</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ade2ff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">tags</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">=</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">[</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4b57c"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">"license"</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">,</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4b57c"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">"kill"</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">]</span></span></span></span></span></span><br /><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">set</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ade2ff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">obj</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">.</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#dcdcaa"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">tags</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">=</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ade2ff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">tags</span></span></span></span></span></span>
</p>

All properties use the right data type and the tags use values inside values allowed in the Schema for this array. Now, see a JSON Object invalid:

<p style="line-height:1.295; background-color:#1e1e1e">
  <span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">set</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ade2ff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">obj</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">=</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">{}</span></span></span></span></span></span><br /><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">set</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ade2ff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">obj</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">.</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#dcdcaa"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">name</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">=</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4b57c"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">"Agent 007"</span></span></span></span></span></span><br /><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">set</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ade2ff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">obj</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">.</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#dcdcaa"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">artist</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">=</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4b57c"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">"Pierce Brosman"</span></span></span></span></span></span><br /><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">set</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ade2ff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">obj</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">.</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#dcdcaa"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">description</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">=</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4b57c"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">1</span></span></span></span></span></span><br /><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">set</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ade2ff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">tags</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">=</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">[]</span></span></span></span></span></span><br /><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">set</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ade2ff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">tags</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">.</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#dcdcaa"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">"0"</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">=</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4b57c"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">"license"</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><br /><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">set</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ade2ff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">tags</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">.</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#dcdcaa"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">"1"</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">=</span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="color:#d4b57c"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">"love"</span></span></span></span><br /><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">set</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ade2ff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">obj</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">.</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#dcdcaa"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">tags</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ffffff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">=</span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#d4d4d4"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:10.5pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Consolas,sans-serif"><span style="color:#ade2ff"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">tags</span></span></span></span></span></span>
</p>

This object sets an integer property to a description (the valid type is string) and sets the  value “love”, out of valid values allowed to array tags.  
The site https://json-schema.org/ has tools, samples and learning resources to learn on how to validate and write advanced validation rules using JSON Schema.