OpenAPI to JSON Schema Converter — Free Online

Extract OpenAPI 3.0–3.2 components.schemas into JSON Schema — default Draft 2020-12 ($defs), optional Draft-07 (definitions). Browser-local, no upload.

Loading…
OpenAPI to JSON Schema documentation
Extract OpenAPI components.schemas into JSON Schema (2020-12 or Draft-07).

Developer notes

OpenAPI 3.0 schemas convert via @openapi-contrib/openapi-schema-to-json-schema. OpenAPI 3.1 / 3.2 use a best-effort strip of OAS-only keywords. Default output: $schema 2020-12 + $defs; optional Draft-07 remap ($schema + definitions + #/definitions refs). Live convert on paste/sample; explicit Convert (⌘↵) for manual edits; Monaco JSON/YAML input + Shiki JSON output. Empty components.schemas → error. External $ref rejected. Max input 512 KiB.

Options

Target draft
2020-12 (default) emits $schema + $defs. Draft-07 remaps to the Draft-07 $schema URI, definitions instead of $defs, and #/definitions/… refs — a structural rename only; 2020-12-only keywords are not rewritten.

Use cases

Reuse OpenAPI models as standalone JSON Schema. Feed extracted schemas into JSON Schema Validator. Diff schema shapes outside of a full OpenAPI document.

Examples

OpenAPI YAML → JSON Schema $defs

Before

openapi: "3.0.3" info: title: Pets version: 1.0.0 paths: {} components: schemas: Foo: type: object properties: id: type: string Bar: type: object properties: name: type: string

After

{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$defs": { "Foo": { ... }, "Bar": { ... } } }

Empty schemas rejected

Before

openapi: "3.0.3" info: title: t version: "1" paths: {} components: schemas: {}

After

Error: empty components.schemas

OpenAPI to JSON Schema FAQ

Common questions

Is 3.1 conversion identical to Draft-07?

No. OpenAPI 3.1/3.2 conversion is a best-effort keyword strip. Default output is Draft 2020-12 ($defs). Choose Draft-07 for a structural remap (definitions + Draft-07 $schema) — not a full keyword rewrite. See Options.

What if there is no Root schema?

All schemas land under $defs (or definitions when Draft-07 is selected) with no invented root type/properties. A schema named Root also gets a top-level $ref to that entry.

Related tools?

Convert the other way with JSON Schema to OpenAPI, or validate the OpenAPI source with Validate OpenAPI.

OpenAPI tools to format, validate, and lint your specs.