JSON Schema Generator Online
Infer a draft 2020-12 JSON Schema from sample objects, arrays and primitive values.
Open JSON Schema GeneratorFree · No sign-up · Browser-based processing
What JSON Schema Generator does
Create a starting JSON Schema from sample data. Object fields present in every observed sample become required; optional fields remain optional. Arrays are inspected across their items, and heterogeneous values produce type alternatives. A sample cannot reveal every business rule, so refine the schema before enforcing it.
Common uses
- Bootstrap API payload validation
- Document observed configuration shapes
How to use JSON Schema Generator
- Paste representative JSON, including optional fields and different array values.
- Run the generator to infer types, properties and required fields.
- Copy the schema and refine bounds, formats and allowed values; use JSON Schema Validator to check supported rules.
Privacy: Runs locally in your browser. Input is not uploaded to the DevNet Kit server.
JSON Schema Generator example
Try the tool with this representative input:
[{"id":1,"name":"Ada"},{"id":2,"name":"Linus","active":true}]Expected result
id and name are required within array items; active is optional.JSON Schema Generator FAQ
Which schema draft is generated?
The output declares JSON Schema draft 2020-12 and uses type, properties, required, items and anyOf.
Can it infer all constraints?
No. It cannot infer intended enums, formats or numeric ranges from examples. An empty array produces an unconstrained item schema.
Infer required and optional fields from sample API records
Paste an array containing representative API records, including records that omit optional properties. The generator examines the array items and marks an object field as required only when it appears in every observed object of that shape.
The result is a starting schema, not a complete API contract. A small sample cannot reveal intended string formats, business rules or allowed numeric ranges. Review the generated properties and required lists before enforcing validation.
Worked example
Input and settings:
[{"id":1,"name":"Ada"},{"id":2,"name":"Linus","active":true}]Expected result or interpretation:
The array-item schema requires id and name. The active property has type boolean but is not required.Questions about this workflow
Why is a property optional in the generated JSON Schema?
A field omitted from one or more observed objects is not added to that object schema's required list. Include realistic examples, then edit required to match your actual contract.
Does one sample email address infer an email format constraint?
No. A string sample is inferred as a string. Add format, pattern, length and other constraints yourself when they are part of the intended contract.