JSON

JSON Schema Generator

Paste a sample JSON payload to infer a JSON Schema — types, required fields, and nullable values, detected automatically. Runs entirely in your browser.

Indent
Sample JSON
Generated Schema
Paste or type a sample JSON payload on the left to see its inferred schema here.

Quick Learn

A JSON Schema describes the shape a JSON document is expected to have — which keys exist, what type each value should be, and which keys are required — so that tools, editors, and validators can check a payload without a human reading it line by line. It's the same idea as a database schema or a TypeScript interface, expressed in JSON itself.

Writing one by hand is tedious, so this tool infers it from a real example instead: paste a representative payload and it walks the structure, recording each field's type. When the sample is an array of objects, it looks across every item — a field present in every item becomes required, a field that only shows up sometimes becomes optional, and a field that's sometimes a string and sometimes null becomes a nullable string. Everything runs locally in your browser.

Best Practices

  • •A schema inferred from one example is only as good as that example — if your real data has fields the sample doesn't, feed in a payload that covers those cases (or several merged together) before relying on the result.
  • •Turn on "Strict" only once you're confident the sample's fields are the complete set — additionalProperties: false will reject any payload with an extra key, including harmless ones added later by an upstream API.
  • •Turn off "Required Fields" when you want a permissive schema for validating loosely-structured or evolving data, and keep it on when you want to catch missing fields early.
  • •Treat the generated schema as a starting point, not a final spec — review field names that look like they should have stricter constraints (enums, formats like "email" or "date-time", min/max) and add them by hand.

More JSON Tools

See all JSON tools

Frequently Asked Questions

Is my data uploaded or stored anywhere?

No. The schema is inferred entirely in your browser from the JSON you paste — nothing is sent to a server or stored anywhere.

What does "Required Fields" do?

When on, any key present in your sample (or present in every item of a sample array) is added to that schema's required list. When off, every field is optional — useful for a looser, more forgiving schema.

What does "Strict (No Extra Props)" do?

It sets additionalProperties: false on every object in the schema, so a payload with any key not seen in your sample will fail validation. Leave it off if your real data may legitimately include extra fields.

How does it handle an array where items have different shapes?

It merges the inferred schema of every item: fields common to all items stay required, fields that only appear in some items become optional, and a field whose type varies across items (e.g. string in one, null in another) becomes a schema with multiple allowed types.

Does it detect formats like email, date, or UUID?

No — it infers structural types (string, number, boolean, object, array, null) only. Format-level constraints are easy to add by hand afterward if you know a field should be an email address, date-time, or similar.

Want the engineering deep-dives behind tools like this one?