JSON Schema Generator
Generate a JSON Schema draft from a JSON sample.
Category: Converters
When to use?
Use it to quickly draft a validation JSON Schema from an API response sample.
How to use
- Paste a JSON sample.
- Check the auto-inferred schema.
- Adjust fields and use it.
Input Explanation
Enter a JSON sample as an object or array.
Calculation Basis
It recursively infers types from the sample values to generate a JSON Schema draft 2020-12 draft.
Usage Examples
- API validation draft - Make a schema draft from sample JSON.
- Document data structure - Organize the JSON structure as a schema for documentation.
- Prepare input validation - Make a starting point for a schema to validate form or API input.
Examples
- {"id":1,"name":"A"} → schema with id integer, name string
- A user-list JSON sample → a schema draft with each field type inferred
Cautions
- It is sample-based inference and may not represent every case of the real API.
- A mismatched encoding standard or complex nested data may break or drop the structure.
FAQ
Is it a finished schema?
It is a draft. Refine nullable, enum, format, etc. yourself.
Which JSON Schema version does it follow?
It drafts based on the widely used JSON Schema structure.
Can I merge several samples?
It builds from one sample at a time. Merge differences across samples into the result yourself.
Are required properties shown?
It builds from the sample's properties; adjust required status to fit your data.
Related Tools
- JSON Flatten Converter - Flatten nested JSON into a flat key-value structure.
- JSON ↔ TypeScript Type Converter - Convert between JSON samples and TypeScript type declarations to draft types and sample JSON.
- JSON Formatter - Beautify or minify JSON strings instantly and check for validity errors.
- JSONPath Tester - Extract values from JSON data using a JSONPath expression.
- URL Encode / Decode - Encode text into URL-safe form (%XX) or decode an encoded URL back to text.
- Base64 Converter - Encode text to Base64 or decode a Base64 string back to text.