jsonsql.dev 100% client-side
§

JSON Schema Generator

Generate JSON Schema (Draft 2020-12) from sample data instantly in your browser

JSON Input
Generated Schema

How to generate JSON Schema from sample data

jsonsql.dev generates JSON Schema (Draft 2020-12) instantly in your browser. No data is sent to any server — your JSON stays on your machine.

Paste sample JSON — paste a JSON object or array that represents your data structure into the input editor on the left.

Click Generate Schema — the tool analyzes your JSON structure, infers types, detects string formats (email, URI, date, UUID), and produces a complete JSON Schema.

Copy or download — click Copy to copy the schema to your clipboard, or Download to save it as a .json file.

Example

Input:

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Alice Johnson",
  "email": "[email protected]",
  "age": 30,
  "active": true,
  "website": "https://alice.dev",
  "created": "2026-01-15T10:30:00Z",
  "tags": ["developer", "writer"]
}

Generated schema (Draft 2020-12):

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": { "type": "string", "format": "uuid" },
    "name": { "type": "string" },
    "email": { "type": "string", "format": "email" },
    "age": { "type": "integer" },
    "active": { "type": "boolean" },
    "website": { "type": "string", "format": "uri" },
    "created": { "type": "string", "format": "date-time" },
    "tags": {
      "type": "array",
      "items": { "type": "string" }
    }
  },
  "required": ["id", "name", "email", "age", "active", "website", "created", "tags"]
}

Features

  • Generates JSON Schema Draft 2020-12 from any sample JSON data
  • Infers types: string, number, integer, boolean, null, object, array
  • Detects string formats: email, URI, date, date-time, IPv4, UUID
  • Handles nested objects recursively with full property schemas
  • Handles arrays by merging item schemas from all elements
  • Supports mixed types with oneOf
  • Detects required fields from array items (present in all objects)
  • Optional: include examples from sample data
  • Optional: include auto-generated descriptions
  • Copy schema or download as .json file
  • Dark and light theme support
  • Works offline — 100% client-side, no data uploads

JSON Schema Generator vs other tools

Feature jsonsql.dev jsonschema.net quicktype.io
Browser-based Yes Yes Yes
Client-side only Yes No (server) No (server)
Draft 2020-12 Yes Yes Draft-06
Format detection Yes (6 formats) Yes Limited
Mixed type support Yes (oneOf) Yes Yes
Include examples Yes (toggle) Yes No
Download schema Yes Yes Yes
Dark mode Yes No No
No sign-up Yes Free tier Yes

Understanding JSON Schema Draft 2020-12

JSON Schema is a vocabulary for annotating and validating JSON documents. Draft 2020-12 is the latest stable version, replacing Draft 2019-09. Key improvements include the $dynamicRef keyword and simplified prefixItems for tuple validation.

A JSON Schema describes the shape of your data — property names, types, required fields, string formats, array item types, and more. Schemas are used for API validation, form generation, documentation, and code generation.

Related tools

Frequently asked questions

What JSON Schema draft version does this tool generate?

This tool generates JSON Schema Draft 2020-12, the latest stable version of the JSON Schema specification. The output includes the $schema keyword pointing to the official 2020-12 meta-schema.

Does it detect string formats like email and date?

Yes. The generator detects 6 string formats automatically: email, URI, date (YYYY-MM-DD), date-time (ISO 8601), IPv4 addresses, and UUIDs. Detected formats are added as the "format" keyword in the schema.

How does it handle arrays with mixed types?

When an array contains elements of different types, the generator creates a oneOf schema listing each unique type. For example, an array with strings and numbers produces items: { oneOf: [{ type: "string" }, { type: "number" }] }.

How are required fields determined?

By default, all properties found in an object are marked as required. For arrays of objects, the tool detects which keys appear in every item and marks only those as required. You can also toggle "All required" to force all fields as required.

Can I include examples in the generated schema?

Yes. Enable the "Examples" toggle in the toolbar to include example values from your sample data in the generated schema. This is useful for API documentation and OpenAPI specs.

What is the difference between number and integer types?

The generator distinguishes between integer (whole numbers like 42) and number (decimals like 3.14). In JSON Schema, integer is a subtype of number — an integer value also validates against a number schema, but not vice versa.

Can I use the generated schema with OpenAPI or Swagger?

Yes. JSON Schema Draft 2020-12 is fully compatible with OpenAPI 3.1. You can paste the generated schema directly into your OpenAPI spec under the components/schemas section. For OpenAPI 3.0 (which uses a JSON Schema subset), you may need to remove the $schema keyword and adjust format annotations.

How do I generate a schema from an array of objects with different fields?

Paste the full array as input. The generator analyzes all objects in the array, merges their properties, and marks only the keys that appear in every item as required. Properties that appear in some but not all items are included but not required, giving you an accurate schema that validates the entire dataset.

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

Draft 2020-12 replaces definitions with $defs, uses prefixItems instead of tuple validation with items, and adds new vocabulary support. Most validators now support 2020-12, including ajv (v8+), jsonschema (Python 4.x+), and everit-json-schema. If your tooling requires Draft-07, you can manually change the $schema URL in the output.

Does the generator handle nullable fields and null values?

Yes. If a field contains null in your sample data, the generator infers a oneOf with the null type and any other detected types (e.g., oneOf: [{type: "string"}, {type: "null"}]). If a field is null in all samples, it is typed as {type: "null"}.