DevPik Logo

JSON Schema Generator

Generate JSON Schema from any JSON data. Auto-detects types, formats, required fields, and supports Draft 2020-12 and Draft-07.

How to Use JSON Schema Generator

  1. Paste your sample JSON data into the left panel. The schema generates in real-time as you type.
  2. Customize options: choose Draft 2020-12 or Draft-07, toggle format detection (email, URI, UUID, date), required fields, and enum detection.
  3. Add an optional title and description for your schema using the input fields above the panels.
  4. Switch to Validate mode to paste a JSON Schema and validate any JSON data against it.
  5. Copy the generated schema or download it as a .json file.

About JSON Schema Generator

JSON Schema Generator is a free online tool that auto-generates a JSON Schema from any sample JSON data. JSON Schema is a powerful vocabulary for annotating and validating JSON documents — it's used for API validation, documentation generation, code generation, and automated testing. This tool analyzes your JSON structure recursively: detecting types (string, number, integer, boolean, null, array, object), identifying common string formats (email, URI, UUID, date, date-time, IPv4, IPv6), marking required fields, handling homogeneous and heterogeneous arrays, and merging schemas from multiple array objects. Output supports both Draft 2020-12 (latest) and Draft-07 (widely supported). The built-in Validate mode lets you test JSON data against any schema. All processing runs 100% client-side — your data stays private.

Frequently Asked Questions

What is JSON Schema?

JSON Schema is a declarative language for describing the structure and validation constraints of JSON data. It specifies which properties are allowed, their types, which are required, string formats, array item types, and more. It's used for API request/response validation, form generation, documentation, and code generation.

How do I generate a JSON Schema from JSON?

Paste your sample JSON data into the left panel and the tool instantly generates a matching schema. The generator analyzes types, detects patterns like email and UUID formats, marks required fields, and handles nested objects and arrays. You can customize the output by toggling format detection, required fields, and enum detection.

What is the difference between Draft 2020-12 and Draft-07?

Draft 2020-12 is the latest JSON Schema specification with improved vocabulary system, dynamic references, and cleaner semantics. Draft-07 is older but has wider tooling support. For most use cases, Draft 2020-12 is recommended. This tool supports both — select your preferred draft from the dropdown.

Can I validate JSON against a schema?

Yes! Switch to Validate mode using the button in the toolbar. Paste your JSON data in the left panel and your JSON Schema in the right panel, then click Validate. The tool checks types, required fields, enum values, and formats, reporting all validation errors with JSON paths.

What string formats does the tool detect?

When format detection is enabled, the tool recognizes: email addresses, URIs (http/https URLs), date-time (ISO 8601), dates (YYYY-MM-DD), times, UUIDs, IPv4 addresses, and IPv6 addresses. These are added as "format" keywords in the generated schema.

How does the tool handle arrays?

The generator inspects all array items to determine the schema. Homogeneous arrays (all items same type) get a single items schema. Arrays of objects are merged — all property schemas are combined and required fields are detected based on which keys appear in every object. Heterogeneous arrays use oneOf.

Is my data safe with this tool?

Yes. This JSON Schema generator runs 100% client-side in your browser. No JSON data is ever sent to any server. Your data stays completely private on your device.

Related Tools

Was this tool helpful?