Code Beautifier

JSON to JSON Schema

Generate a JSON Schema from a JSON sample, with required fields, nullable types, and formats like email and date-time inferred from the data.

Draft saved locally.

Local workspace

Named projects in IndexedDB · Local only — never synced to our servers. Worksp

Open manager

Batch workspace

Format multiple files locally in one run.

Draft:
json
json

Options

OptionDescription
DraftSets the $schema URI. The generated keywords work in both drafts.
Detect formatsAdds format for date-time, date, email, uuid, uri, and ipv4 when every string at that position matches.
Allow extra propertiesTurn off to add additionalProperties: false, so validation fails on keys the sample didn't have.

FAQ

How does it decide which properties are required?

A property is required when it appears in every object at that position, such as every item of an array. Keys missing from some items are left out of the required list.

Which string formats are detected?

date-time, date, email, uuid, uri, and ipv4, and only when every string at that position matches. Validators need format support, such as ajv-formats, to enforce them.

Should I use draft 2020-12 or draft-07?

2020-12 is the current draft. Choose draft-07 for older validators and tooling. The generated keywords are the same in both; only the $schema URI changes.

Why does a property allow null?

The samples had null at that position alongside another type, so the schema allows both, for example type: ["string", "null"].

Should I edit the generated schema before using it?

Yes. A sample can't show enums, minimum and maximum values, or patterns, so add those constraints before treating the schema as a contract.