Skip to content
Free Tool Arena

Developer Utilities · Free tool

JSON Schema Generator

Create a draft-07 schema with types and required fields from any JSON instantly in your browser—free tool with no sign-up or download.

Updated June 2026
Found this useful?EmailBuy Me a Coffee

Advertisement

What it does

JSON Schema is the de facto standard for describing the structure and constraints of JSON data. Where JSON itself is just a data format, JSON Schema specifies what valid JSON looks like — required fields, allowed types, value ranges, string patterns, array length limits, nested-object structures. It's used to validate API request and response bodies, generate forms from schemas, document configuration files, drive code-generation in dozens of languages, and underlie OpenAPI / Swagger specifications. Modern API tooling (Stripe, GitHub, AWS, OpenAI all expose OpenAPI definitions which embed JSON Schema) depends on it.

Writing JSON Schema by hand from scratch is tedious — for a complex API response with 30 fields, you're looking at hundreds of lines of schema. The generator inverts the problem: paste a sample JSON document, and it infers the schema automatically. Type inference walks the structure: strings stay string, numbers become number, booleans boolean, arrays infer their item type from the first element (or use “oneOf” if items vary), objects recursively become schema definitions. Required fields are inferred from what's present in your sample. The output is a draft-07 (or 2019-09 / 2020-12) JSON Schema ready to paste into your validation library.

Caveats: inference from a single sample isn't perfect. The generator can't know which fields are optional (it sees all-present in your sample, marks all required), can't infer format-specific constraints (email pattern, date format, UUID), can't infer enum values from a single string sample. So treat the generated schema as a STARTING POINT — you'll need to manually mark optional fields, add format hints (“ format: email”, “format: date-time ”), define enums where applicable, set minimum/maximum constraints, and add descriptions for documentation. The generator saves you 70-80% of the typing; the remaining 20-30% is judgment calls only you know.

Embed this tool on your siteShow snippet

Paste this snippet into any page. Loads on-demand (lazy), no tracking scripts, and sized to most dashboards. Replace the height to fit your layout.

<iframe src="https://freetoolarena.com/embed/json-schema-generator" width="100%" height="720" frameborder="0" loading="lazy" title="JSON Schema Generator" style="border:1px solid #e2e8f0;border-radius:12px;max-width:720px;"></iframe>
Embed docs →

How to use it

  1. Paste a sample JSON document representative of your data shape.
  2. Click Generate — schema is inferred from the structure.
  3. Review the output: types, required fields, nested object shapes.
  4. Edit manually: mark fields optional (remove from required[]), add format hints, set enums, add descriptions.
  5. Copy the schema and use it with a validator (Ajv for JS, jsonschema for Python, etc.).

When to use this tool

  • Bootstrapping a JSON Schema for a new API endpoint from a sample response.
  • Documenting an existing API where you have data but no formal schema.
  • Generating OpenAPI definitions — copy schemas into the components/schemas section.
  • Driving form generation — many JSON-Schema-based form tools (RJSF, json-editor) use schemas to render UIs.
  • Validating LLM JSON outputs — use the schema in a validator to enforce structure.

When not to use it

  • When you have multiple sample variants — feeding only one may misinfer required vs optional. Combine multiple samples or use a tool that handles arrays of samples.
  • When format-specific validation matters (email, URL, UUID, date) — generator can’t infer these; you must add format hints manually.
  • For TypeScript types directly — use a JSON-to-TS converter; TypeScript types are not the same as JSON Schema.
  • For schema design — a real schema involves business logic (constraints, references, conditionals) that can’t be inferred from data alone.

Common use cases

  • Pre-decision sanity-check on inputs and outputs
  • Educational use &mdash; demonstrating the underlying concept
  • Onboarding a colleague who needs the same calculation/conversion
  • Verifying a number or output before passing it on

Frequently asked questions

Which JSON Schema draft should I use?
Draft-07 is the most widely-supported in tooling; safe default. Draft 2019-09 added unevaluatedProperties / unevaluatedItems and improved $ref behavior; Draft 2020-12 split into vocabularies for modularity and is the latest. Most validators support 07 by default and 2019-09 / 2020-12 with explicit version specification. Pick based on your toolchain.
How do I make fields optional?
Edit the generated schema manually. The generator infers all present fields as required; for optional fields, remove them from the required array. Or use additionalProperties (allow extra unknown fields) and a more permissive structure if your API has many optional fields.
Can I generate schema for variant array items?
If your sample array has mixed item types (some strings, some objects), the generator typically infers union types via oneOf or anyOf. Review carefully — sometimes the schema becomes overly permissive. Better approach: design the schema explicitly using oneOf with separate schemas for each variant.
How do I add format hints (email, URL, UUID)?
Manually edit. After generating the base schema, change `"type": "string"` for an email field to `"type": "string", "format": "email"`. JSON Schema defines several built-in formats (email, uri, uuid, date, time, date-time, ipv4, ipv6, hostname). Most validators check these formats out of the box. Custom formats require validator-specific setup.
What's the difference between properties and patternProperties?
properties define exact-name fields (firstName, age). patternProperties define dynamic-name fields matching a regex (e.g., any field starting with &ldquo;user_&rdquo;). Use properties for known fixed schema; patternProperties for maps/dictionaries with predictable key patterns. Both are valid; pick based on your data shape.
Can I include $ref to other schemas?
Generator typically inlines everything. For shared sub-schemas (e.g., Address used in multiple places), manually refactor to use $ref pointing to /definitions/Address (draft-07) or /$defs/Address (2019-09+). Refactoring after generation is normal — generators give you a starting structure; reuse comes from manual cleanup.

Advertisement

Learn more

Explore more developer utilities tools

100% in-browserNo downloadsNo sign-upMalware-freeHow we keep this safe →

Found this useful?

The tools stay free thanks to readers who chip in or spread the word.

Buy Me a Coffee