Skip to content
Schema helper

JSON to OpenAPI schema

Generate an OpenAPI component schema from sample JSON in one click.
Objects and arrays are mapped to JSON Schema with required fields, and mixed arrays become oneOf definitions.
Everything runs locally in your browser—no data is sent anywhere.

Guide: How to use & features

  • Paste JSON into the input and hit “Convert to OpenAPI.”
  • Objects expand into JSON Schema with properties plus a required array.
  • Arrays infer the element type; if multiple types appear, the tool outputs oneOf.
  • Use copy or clear to reuse the schema or start fresh.

Samples: Sample input & output

Infer schema from a profile object

Input

{"name":"Jane","email":"[email protected]","verified":true}

Output

{
  "type": "object",
  "properties": {
    "name": {"type": "string"},
    "email": {"type": "string", "format": "email"},
    "verified": {"type": "boolean"}
  },
  "required": ["name", "email", "verified"]
}

FAQ: FAQ

  • Does it generate a full OpenAPI spec or just the schema part?

    It generates schema definitions (in JSON Schema form) suitable for components/schemas. It does not include paths or endpoint definitions, so the intended workflow is to paste the output under components in your spec file and reference it with $ref from each API’s requestBody or response.
  • How is the required list decided?

    Keys present in the sample JSON are emitted as required. Remove fields you want to be optional from the required array after generation. Note that optional fields missing from the sample will not appear in the schema at all.
  • How are arrays with inconsistent items represented?

    Arrays whose element types vary are expressed with oneOf, letting you describe arrays that can take several shapes. If the result gets unexpectedly complex, tidying the input sample produces a more concise schema.

Use cases: Common use cases

  • Drafting schemas

    Transform JSON samples into OpenAPI schema stubs to seed documentation or mock generation.

  • Sharing endpoint expectations fast

    Convert request/response examples and paste them into PRs or issues to align on contract details.

  • Checking consistency with existing specs

    Compare generated stubs with current definitions to spot fields that need updates.

Notes: Notes & limitations

  • Work stays in your browser

    Inputs and outputs remain local. Closing the tab or clearing cache will remove any temporary state.

  • Validate critical data

    Results are helper outputs—double-check them before sending to production systems or sharing externally.

  • Large payloads depend on your device

    Very large text or files can feel slow in some browsers. Use a desktop environment for heavy workloads.

JSON to OpenAPI Schema Generator

Instantly infer and generate OpenAPI (Swagger) 3.x components.schemas YAML/JSON definitions by simply pasting an exogenous API response or a design-phase dummy JSON object.
During REST API development or technical documentation authoring, manually mapping out massive JSON properties and dictating types is a tedious, error-prone task. This structural inference tool automates the heavy lifting of reverse-engineering your API schema, accelerating your documentation process.

Articles for this tool

Recent Articles

Use Case
2026-08-07

curl Options Cheat Sheet: What -X, -H and -d Actually Do

A reference for the curl options you meet in real API work: why -d already implies POST, how -d differs from --data-raw, the @ prefix that silently reads a file, single vs double quotes, and why -k and -L deserve more caution than they usually get.

Introduction
2026-08-06

Converting Between JSON Schema and Zod: How required Maps to .optional()

Inside a two-way converter that turns JSON Schema into a Zod schema and Zod code back into JSON Schema. Covers the inverted defaults between required and .optional(), the constraint mapping table, and how the Zod side is parsed without executing any code.

Use Case
2026-08-06

SQL Clause Order Reference: Why WHERE Can't See Your SELECT Alias

The order you write SQL clauses is not the order the database runs them. A reference for the logical execution order (FROM → WHERE → GROUP BY → HAVING → SELECT → ORDER BY → LIMIT), why aliases fail in WHERE, when to use WHERE vs HAVING, and the MySQL/PostgreSQL differences that bite.

Use Case
2026-08-06

Unified Diff Format Reference: Reading @@ Hunks in git diff Output

How to read the unified diff format git produces: what the four numbers in @@ -12,7 +12,9 @@ mean, why a one-character edit shows as a whole-line replacement, the whitespace and line-ending traps, \ No newline at end of file, combined @@@ diffs on merges, and rename detection via similarity index.

Use Case
2026-08-06

UTC to JST Reference: The 9-Hour Offset, Cheat Sheet & Timezone Pitfalls

Convert between UTC and JST (Japan Standard Time) with a cheat sheet. Covers what Z and +09:00 mean in ISO 8601, when JavaScript date parsing silently shifts by 9 hours, MySQL/PostgreSQL timezone behavior, and why GitHub Actions cron always runs in UTC.

Use Case
2026-08-04

CREATE TABLE Reference: MySQL vs PostgreSQL vs SQLite Types & Constraints

A cross-database CREATE TABLE (DDL) reference with cheat sheets for data types, auto-increment keys (AUTO_INCREMENT / IDENTITY / rowid), foreign key ON DELETE behavior, and the CHECK constraint that MySQL silently ignores.

Ad

Ad