OpenAPI to JSON Schema
Convert OpenAPI 3.0, 3.1, and Swagger 2.0 schemas, request bodies, and responses to standalone JSON Schema.
Frequently Asked Questions
How do I convert an OpenAPI spec to JSON Schema?
Paste your OpenAPI or Swagger spec (YAML or JSON) on the left, or upload the file. Pick what to convert in the Convert menu: every schema in one bundle, a single schema from components/schemas, or the parameters, request body, or a response of one operation. The JSON Schema appears on the right.
Why is OpenAPI not exactly JSON Schema?
OpenAPI 3.0 uses an extended subset of an older JSON Schema draft. It has nullable instead of type arrays, boolean exclusiveMinimum, a single example instead of examples, and keywords such as discriminator and xml. This tool rewrites those into standard JSON Schema. OpenAPI 3.1 already aligns with JSON Schema 2020-12, so far fewer changes are needed.
What happens to nullable: true?
A schema with a type becomes a type array, for example type: ["string", "null"], and null is added to its enum if it has one. A nullable $ref or allOf is wrapped as anyOf with a null branch, and a nullable oneOf or anyOf gets an extra null option.
How are $ref references handled?
References to #/components/schemas/Name (or #/definitions/Name in Swagger 2.0) become #/$defs/Name in draft 2020-12 or #/definitions/Name in draft-07. When you convert a single schema or operation, the schemas it depends on are copied into $defs so the result works on its own. Circular references are kept as references. References to other files are left as they are, because everything runs in your browser and nothing is fetched.
Which JSON Schema draft should I choose?
Use 2020-12 for current validators and OpenAPI 3.1 projects. Choose draft-07 for tools that only support it, such as many older validators and form libraries. In draft-07, keywords placed next to a $ref are ignored, so this tool moves them beside an allOf that wraps the reference.
Why would I strip OpenAPI-only formats?
Formats like int32, int64, float, double, and byte are not defined by JSON Schema. Strict validators such as Ajv reject unknown formats unless you configure them. Turn on "Strip OpenAPI-only formats" to remove them (byte becomes contentEncoding: base64). Vendor extensions starting with x- can be stripped for the same reason.
Is my API spec uploaded anywhere?
No. The conversion runs entirely in your browser, so your spec never leaves your device. The tool is free and needs no signup.