Skip to content

JSON Schema Generator From an Example

Paste an example of your JSON and get a JSON Schema for it, in plain, OpenAI or Anthropic form, with every guess it had to make listed underneath.

Properties described
10

Nesting depth 3. A schema is sent with every request that uses it, so its size is a per-request cost.

Optional keys found
1
Enums detected
2
Schema characters
1,181
Estimated schema tokens
≈ 295
Warnings
1
Keys that were not in every object:
  • closed_at (in 1 of 3 objects)
Enums inferred:
  • status → 2 values
  • tags[] → 2 values
Things you should check:
  • The top level of your example was an array, so the schema describes ONE element and merges every element's keys. Wrap it in { "items": … } yourself if you want the list.
What this assumes: types come from the example alone, so a field that is an integer in every row you pasted becomes integer even if it can be fractional. A key counts as required only if it appeared in every object at that path. Token figures are characters ÷ 4 and are estimates, not a tokenizer's count. Everything on this page runs in your browser. Nothing you paste is uploaded, logged or sent anywhere.

A schema written from an example is nearly always better than one written from memory, because the example contains the fields you forgot: the nullable assignee, the timestamp that only exists once a record is closed, the array that happened to be empty. This tool folds every object it finds at the same path into one description, which is why pasting twenty rows produces a far more honest required list than pasting one.

What the strict toggle changes

Strict structured-output modes generally demand that every property appears in required and that additionalProperties is false — which sounds incompatible with optional fields until you notice the standard workaround: keep the key required and let its type be ["string", "null"]. That is what the toggle does to any key that was missing from some of your objects, and the list of which keys were affected is printed above so you can disagree with it.

Where it will be wrong

Three places, all of them printed rather than hidden. An empty array gives no item type. A field that was null in every row gives no type at all. And a small set of repeated strings looks exactly like an enum whether or not it is one — a status column with three values in your sample may have nine in production, so the enum ceiling is a field you can turn down to zero effect by unticking the box. The schema is a draft to edit, not an authority; the value is that the tedious 90% is already typed.

JSON Schema Generator From an Example · Multigrid