Tools

Home
JSON FormatterSQL FormatterJS ValidatorMinify CSS
Merge PDFCompress PDFImage to PDF
JPG to PNGPNG to WebPCrop Image

JSON to JSON Schema Generator

Paste JSON and instantly generate a valid JSON Schema with type inference, required fields, and nested definitions

Your files never leave your browser
Input JSON0 chars, 0 lines
Generated Schema0 chars, 0 lines
Ready·

Paste any JSON — a 5-field object or a 300-line nested API response — and get a valid JSON Schema (draft-07 or draft-04) with inferred types, required fields, and recursive definitions in under a second. No signup, no config files, no CLI setup. And everything runs in your browser. Nothing gets uploaded.

How It Works

Paste JSON
→
Infer Types & Structure
→
Output JSON Schema

The parser reads each value in your JSON and maps it to the correct schema type: strings, integers (whole numbers only), numbers (decimals), booleans, and nulls. Objects get recursive treatment — every nested level gets its own properties block with required fields filled in. Arrays of objects are merged so the schema captures all possible keys across every item in the array.

Examples

Simple User Object

A basic user profile from a REST API — the kind you’d get from /api/users/1.

INPUT
{ "id": 1, "name": "Alice", "email": "[email protected]", "active": true }
OUTPUT
{ "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "email": { "type": "string" }, "active": { "type": "boolean" } }, "required": ["id","name","email","active"] }

Nested Object with Address

When your JSON has objects inside objects, the schema mirrors that nesting. No extra work on your end.

INPUT
{ "name": "Acme Corp", "address": { "street": "123 Main St", "city": "Springfield", "zip": "62704" } }
OUTPUT
{ "type": "object", "properties": { "name": { "type": "string" }, "address": { "type": "object", "properties": { "street": { "type": "string" }, "city": { "type": "string" }, "zip": { "type": "string" } }, "required": ["street","city","zip"] } }, "required": ["name","address"] }

Array of Products with Mixed Fields

An e-commerce product list where items share some keys but not all. The generator merges every object in the array to catch the full set of properties.

INPUT
[ {"sku": "A1", "price": 9.99}, {"sku": "B2", "price": 24.50, "sale": true} ]
OUTPUT
{ "type": "array", "items": { "type": "object", "properties": { "sku": { "type": "string" }, "price": { "type": "number" }, "sale": { "type": "boolean" } }, "required": ["sku","price"] } }

Who Uses This

👨‍💻 Backend Developers

Generate schemas from API response samples to plug into request validation middleware.

📝 API Designers

Draft OpenAPI spec components by turning example payloads into $ref-ready schemas.

🎓 Students

Learn how JSON Schema maps to actual data — paste examples from class and see the structure instantly.

📊 QA Engineers

Build contract tests fast by generating schemas from known-good responses and validating future runs against them.

Common Mistakes

Pasting invalid JSON

Trailing commas, single quotes, or unquoted keys will break the parser. If you get an error, run your JSON through a validator first. The fix is almost always a missing comma or a stray quote.

Expecting the schema to cover fields that aren’t in your sample

The generator can only see what you give it. If your API sometimes returns an error field that’s missing from your sample, the schema won’t include it. Paste the most complete response you have.

Using draft-04 when you need draft-07 features

Draft-04 is missing things like const, if/then/else, and readOnly. Stick with draft-07 unless the system you’re feeding the schema into specifically requires draft-04.

Technical Details

Frequently Asked Questions

What is JSON Schema used for?

JSON Schema defines the shape of your JSON data — what keys exist, what types they are, which ones are required. It’s used for API request/response validation, form generation, configuration file checks, and contract testing between services. Think of it as a blueprint that lets machines verify data without writing custom code.

What’s the difference between JSON Schema draft-04 and draft-07?

Draft-07 added conditional keywords (if/then/else), const for fixed values, and annotations like readOnly. Draft-04 still works fine for basic validation, but most modern tools expect draft-07 or newer. Only pick draft-04 if a legacy system requires it.

Can I generate a schema from an array of objects?

Yes. Paste the array directly. The generator inspects every object in the array and merges their keys so the resulting items schema covers all possible properties. Keys that appear in every object end up in the required list; keys that only show up in some objects don’t.

Does this tool upload my JSON data anywhere?

No. The entire process runs in JavaScript inside your browser tab. Your data stays on your device. You can disconnect from the internet and the tool still works — that’s a good way to verify if you’re dealing with sensitive payloads.

How do I handle optional fields in the generated schema?

The generator marks every key it sees as required by default (when that toggle is on). If a field is optional in your real data, remove it from the required array in the output. For arrays of objects, fields that don’t appear in every item are automatically left out of required.

Share: