JSON to JSON Schema Generator

Infer a JSON Schema from example data for validation, documentation and OpenAPI.

100% Client-Side Processing — your data never leaves this browser. Works offline. How it works

0 lines • 0 bytes Ready
Tip: drop a file anywhere on the editor
Input
Paste, type or drop a file
1
Result
Updates as you type
// Output will appear here…
About this tool

How the JSON to JSON Schema works

Generate a JSON Schema (draft 2020-12) from example JSON: types, required keys, nested objects, array items and formats like date-time, uuid and uri.

How to use the JSON to JSON Schema

  1. Paste example JSON (several array items give better results).
  2. Set a title and choose strict mode if needed.
  3. Copy or download the schema.

JSON to JSON Schema example

Input
{"id":7,"name":"aarav","tags":["a"]}
Result
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "User",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer"
    },
    "name": {
      "type": "string"
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "required": [
    "id",
    "name",
    "tags"
  ]
}

When to use it

  • Validating API payloads with Ajv or other validators.
  • Writing OpenAPI 3.1 component schemas.
  • Enabling autocomplete for JSON config files in VS Code.

Tip: Add descriptions, enums and minimum/maximum values by hand afterwards; examples cannot reveal those rules.

Required keys

Keys present in every example are listed in required; others stay optional.

Formats

date-time, date, uuid and uri formats are detected from string values.

Integer vs number

Whole numbers become integer; decimals become number.

Strict mode

Optionally add additionalProperties: false to reject unknown keys.

FAQ

Common questions

Which draft is generated?

JSON Schema draft 2020-12, the version used by OpenAPI 3.1. Most validators, such as Ajv, support it.

How are arrays described?

items holds one schema merged from all elements, so optional item fields are detected.

How is null handled?

Values that are sometimes null get a type list such as ["string", "null"].

Is it private?

Yes, the schema is generated in your browser.