JSON to JSON Schema Generator

Generate a starter model from JSON or XML locally.

How the generator works

Paste a JSON object into the input box and press Generate. The tool parses it with JSON.parse, walks the top-level keys, and writes a draft-07 schema in which every property is given a type derived from the value with JavaScript's typeof. It produces a skeleton you then flesh out, not a finished contract.

Worked example

Input:

{ "name": "Ada", "age": 37, "active": true }

Output:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "name": { "type": "string" },
    "age": { "type": "number" },
    "active": { "type": "boolean" }
  }
}

What it infers and what you refine

JSON valueGenerated typeYou should add
"Ada"stringminLength, format, pattern, enum
37numberinteger type, minimum, maximum
truebooleannothing usually
[1, 2]object (from typeof)change to array, add items
{ "a": 1 }objecta nested properties block
nullobjectthe real type, or ["string", "null"]

Also add a top-level "required" array once you know which fields are mandatory, and a "description" on important properties.

When to use it

Use it to bootstrap an API request or response contract from a real payload, to give a validator like Ajv, jsonschema, or everit-json-schema something to check against, or to document the shape of a config file. Starting from a generated skeleton is faster and less error-prone than writing properties by hand.

Can I paste an array at the top level?

The tool expects an object. Wrap a sample array in an object, generate, then move the property into an items block.

Does it add formats like date-time or email?

No. It only sets type. Add "format": "date-time", "email", "uri" and similar yourself.

Will the schema validate my original JSON?

Yes, the skeleton will accept it, because it only constrains types. It will also accept many payloads you would want to reject until you add required and constraints.

Is anything sent to a server?

No. Everything runs in your browser and the JSON never leaves the page.