Pre-launch — your 10 free credits are reserved for launch day. Join the waitlist
schema-sample-data · free tool

JSON Schema Generator

Infer a JSON Schema from a sample payload.

Runs in your browser — your data never leaves it

Paste, type, or drop a file. Runs as you type.

Output appears here as you type.

Worked example

Input
{"id":1,"name":"x","ok":true}
Output
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer"
    },
    "name": {
      "type": "string"
    },
    "ok": {
      "type": "boolean"
    }
  },
  "required": [
    "id",
    "name",
    "ok"
  ]
}

This example is one of JSON Schema Generator's test cases — if the tool stopped producing this output, the build would fail.

Questions

Which JSON Schema version?
Draft 2020-12. Every property present in your sample is marked required — a sample can't tell us what's optional, so it errs toward strict and lets you relax it.
How are arrays of mixed types handled?
As an anyOf union of the item schemas rather than guessing a single type. Heterogeneous arrays are real data, not an error.
Does it tell integers from floats?
Yes — 1 is integer, 1.5 is number, which matters when the schema drives validation.

Related tools