JSON-Utils

JSON Schema Generator

Generate a JSON Schema (draft 2020-12) from an example document. Objects list all keys as required, arrays merge the schemas of their elements, and whole numbers become integer rather than number. Treat the result as a strong starting draft: one sample cannot know which fields your API truly guarantees.

JSON sample
JSON Schema (draft 2020-12)
Result will appear here
Ready. Press Generate schema or Ctrl+Enter.

How to use the JSON Schema Generator

  1. Paste an example JSON document.
  2. Press Generate.
  3. Review the draft 2020-12 schema and tighten it for your API.

Example

score becomes number while counts in your own payloads would become integer.

{
  "name": "json-utils",
  "version": "1.0.0",
  "private": false,
  "tags": ["json", "tools"],
  "author": { "name": "Ada", "active": true },
  "score": 9.5,
  "notes": null
}

Frequently asked questions

Which draft is generated?

JSON Schema draft 2020-12, declared in the $schema field of the output.

How are mixed arrays handled?

Element schemas merge; differing types become an anyOf so the schema still accepts every element of the sample.