Decide what the outer array means
Single-document mode preserves an outer array as the root type. Multiple-sample mode instead merges its elements into one schema for an individual document. To compare array documents, supply an array of arrays.
Schema inference
Start with the example. Select multiple samples only when each top-level array element represents a separate document.
Processing stays in this browser; samples are not uploaded or stored.
1 samples · 7 properties · 0 enums · 0 enums omitted
A JSON Schema generator is useful when the available documentation is a handful of API responses. Combine representative records to reveal optional keys and mixed value types, then inspect the proposed contract instead of treating one response as universal.
Missing and null describe different situations. A required key can still contain null; a non-nullable property may still be absent. The independent controls keep those decisions visible while you develop a schema from evidence.
The JSON Schema generator examines every array element at the same structural position. A field missing from a second object drops out of common required, while an explicit null expands its type. Unrelated nested objects are not merged merely because their keys match.
Enter edit mode to add descriptions or domain rules. Automatic generation stops. If you change the samples and generate again, a separate candidate appears; applying it replaces one schema, with an undo that restores the prior input, options and output.
Single-document mode preserves an outer array as the root type. Multiple-sample mode instead merges its elements into one schema for an individual document. To compare array documents, supply an array of arrays.
Common required uses only object samples at the same position. All required deliberately demands the union of observed fields, even when an earlier sample lacks one. Allowing null does not make a required key optional.
Input and option changes immediately disable export. Automatic generation waits 350 ms; manual mode supports Ctrl/Cmd+Enter. Editing stops automatic generation. A new candidate requires Apply, and Undo restores the previous state.
Select Draft 7, 2019-09 or 2020-12 for the target validator. The JSON Schema generator uses shared type, properties, required, enum and single-schema items syntax. Only the $schema URI differs; this is not a migration tool for existing schemas.
Empty arrays contribute no element type. With only empty arrays, items is an unconstrained object. Mixed numbers become number when any value has a fractional part; 1.0 and 100e-2 remain integer by their mathematical value.
Enable enum inference only when observed values should be the allowed set. Each scalar position collects at most 20 distinct values, counting an added null. Above that limit the entire enum is omitted and the status counts the omission. Objects and arrays are never enum candidates.
Schema inference preserves numeric tokens, including integers beyond JavaScript’s safe range. Equivalent numeric values are deduplicated without rounding. Multiple JSON samples can expose variants, but manual edits receive syntax and root-shape checks only, not full schema validation.
Several records can expose disappearing fields, nulls or changed types that one successful response hides. Choose Multiple samples and place independent documents in one outer array; that wrapper does not become the generated root type.
With Common required, a field is required only when it appears in every object at that position. Null still counts as present. Choose All required or No required fields to impose a different presence policy deliberately.
The allowed types are combined. Integer and fractional observations become number; null is included when seen. Object properties and array items are merged within their own branches, without preserving correlations between other fields.
Multiple mode accepts up to 1,000 documents in one nonempty array, subject to the character, depth and node budgets. Fewer representative examples are often more useful than thousands of identical successful responses.
No. Email addresses, dates and UUIDs remain strings. Add a format yourself only when it is a genuine contract requirement, then check how your chosen validator handles that annotation.
Found an inference case worth checking?
Use the JSON Schema generator with ordinary and edge-case records, then edit the inferred constraints before adding validation to your project.