JSON Schema Validator and Generator

 
JSON



Options for schema generation:



JSON SCHEMA



Options for json generation:



Features:

  • JSON Schema Validator Online: It checks JSON conforms to the definition described by a JSON Schema. It supports JSON Schema draft-07
  • JSON to JSON Schema Converter: It generates a JSON Schema from JSON.
  • JSON Schema to JSON Converter: It generates a sample JSON from JSON Schema (Pattern is not implemented yet).

Fill in the editors below and it will automatically validate that a JSON document conforms to the definition described by a JSON Schema.

If you want use the JSON schema generator or the JSON generator, please fill in only the desired editor and click the appropriate conversion button.


You can see the user guide to help you to use this online JSON schema checker.

User guide

  • Validate JSON from Schema:

    Step 1: Fill "JSON" editor. You can Drag and drop a JSON file, click on "Browse a JSON file"or directly type in the editor.

    Step 2: It is analogous to step 1 ("JSON Schema" editor).

    Step 3: As soon as the editors are filled, the tool checks if the JSON conforms to the schema.If errors are detected then they are displayed below the editors, else a success message is displayed.

    JSON schema user guide

    This tool allows to quickly validate the compliance of your JSON document.

  • Generate a JSON example from a Schema:

    Step 1: Fill "JSON Schema" editor. You can Drag and drop a JSON file, click on "Browse a JSON file"or directly type in the editor.

    Step 2: You can choose the options (below the editor).
    If you check "Only required" then only the required fields will be filled in the generated JSON.

    Step 3: Click on "Generate JSON from Schema" button.

  • Generate a JSON Schema from a JSON document:

    Step 1: Fill "JSON" editor. You can Drag and drop a JSON file, click on "Browse a JSON file"or directly type in the editor.

    Step 2: You can choose the options (below the editor).
    If you check "required" then the fields will be mandatory in the schema.
    If you check "example" then the schema will contain exemples.

    Step 3: Click on "Generate Schema From JSON" button.


JSON Schema Validator

This online JSON Schema Lint tool allows you to validate that your JSON document conforms to the specified schema.It uses the last release of JSON schema (draft-07).

To validate JSON from a Schema, it uses the ajv library.You can visit this website to learn more about this check.

It also allows you to generate JSON and Schema (does not use any external library).

JSON Schema Generator

This JSON Schema Generator allows to generate a JSON schema from a sample JSON document. It offers a user-friendly interface, making it easy to create schemas quickly.

What is JSON Schema?

JSON Schema is used to define how a JSON should be structured, it describes data format for complete structural validation.

This makes it easy to ensure that a JSON is properly formatted, it is useful for automated testing and validating.

JSON Schema provides clear human- and machine- readable documentation.

JSON Schema Example:

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "Tool",
    "description": "An online tool",
    "type": "object",
    "properties": {
        "id": {
            "description": "Tool identifier",
            "type": "integer"
        },
        "name": {
            "description": "Tool name",
            "type": "string"
        }
    },
    "required": ["id", "name"]
}

The JSON Object below conforms to above JSON Schema.

{
    "id": 1,
    "name": "XML diff"
}

Why validate the compliance of JSON data?

The JSON format has emerged in recent years, especially with the use of the REST APIs.

To develop quality Web services, it is important to test and validate JSON responses. This can quickly become difficult when there are many JSON responses to analyze.

JSON Schema can be a great tool to validate the JSON responses! Using the JSON schema can facilitate this validation!

Developers can ensure that their code properly validates and processes data.It can helping to improve the overall quality of their applications.

There are alternatives to JSON Schema, such as TypeSchema which is a JSON format to describe data models in a language neutral format. Before choosing one or the other (or the other alternatives), it is necessary to analyze the advantages/disadvantages of each of them.

You can report a bug or give feedback by adding a comment (below) or by clicking "Contact me" link (at the top right hand corner of the page).

Comments




Niels Muller Larsen-2018-09-24 02:56
Plain and simple. Just does it :)


koopa-2020-03-22 05:25
can we output to draft04? my tool does not support above 4


Cyril-2020-03-22 10:24
Sorry, this is not currently possible.


EJH-2020-09-14 17:19
Object doesn't support property or method 'repeat'​


Vijer-2021-05-30 14:27
There's a bug in the schema to json generator. In the schema I used there was a string element that had a lenght of one (char).
The enum ["1", "2", A"] When the generator created the json it treated it as a number, no "" around it.
I had another enum [ "gold", "silver", "zink", etc. ] the generator created the json with no "" around the value.
So, it appears the enum needs some tweakin.


shortski-2022-03-24 17:03
I had the same issue.
Enumerated string values in the json schema that are being used in the generated json are not enclosed in double quotes.


andrew bard-2021-09-22 17:32
this is an excellent tool!

my only comment is that the text boxes should be bigger and/or resizable


Dick Baker-2022-01-28 00:19
thanks for this useful page.
FYI the text on webpage
"It also allows you generate JSON and Schema (Not use external library)."
might be better worded (English) as
"It also allows you to generate JSON and Schema (does not use any external library)."


Cyril (admin)-2022-02-05 15:18
Thanks!


shortski-2022-03-24 16:59
I encountered what appears to be a bug when gfenerating a json file starting from a json schema.
String values from an "enum" array are inserted into the generated json without quotes.

json schema:.
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://example.com/object1648068705.json",
"title": "Root",
"type": "object",
"properties": {
"object001": {
"title": "object001",
"type": "object",
"properties": {
"string001": {
"title": "Stage_label",
"type": "string",
"enum": [
"value001"
]
}
}
}
}
}

generated example json:
{
"object001":{
"string001": value001
}
}