Integration Studio Tools — sign up and run every tool. No credit card required.
schema-sample-data · Integration Studio Tool

JSON Schema Generator

Infer a JSON Schema from a sample payload.

Your data never leaves your browser

This tool runs entirely on your computer. What you paste or drop is never uploaded, never stored and never seen by us — close the tab and it's gone. How we know

Sign up to run — no credit card required.

Press Run to see the output. Sign up takes ten seconds — no credit card required.

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