Skip to content

JSON to OpenAPI schema generator

Runs in your browser. Nothing is uploaded.

Turn a JSON example into an OpenAPI schema with types, formats and nested objects, ready to paste into a spec.

Input

{
  "id": 1042,
  "status": "shipped",
  "createdAt": "2026-12-05T10:00:00Z",
  "total": 59.9,
  "paid": true,
  "coupon": null,
  "customer": {
    "id": "c_17",
    "name": "Ada Lovelace",
    "email": "ada@example.com"
  },
  "items": [
    {
      "sku": "BOOK-1",
      "quantity": 2,
      "price": 19.95
    },
    {
      "sku": "PEN-3",
      "quantity": 1,
      "price": 20
    }
  ],
  "tags": [
    "gift",
    "express"
  ]
}

Result

Paste, upload or load a file to start

How it works

Paste or upload a JSON example, such as an API response. The page infers a schema from it with the generator APIGit's editor uses and shows it as YAML, ready to paste under components.schemas.

The sample is an order with nested objects, an array of objects, a date and a null. The generated schema:

type: object
additionalProperties: false
properties:
  coupon:
    nullable: true
  createdAt:
    type: string
    format: date-time
  customer:
    type: object
    additionalProperties: false
    properties:
      email:
        type: string
      id:
        type: string
      name:
        type: string
    title: Customer
  id:
    type: integer
  items:
    type: array
    items:
      type: object
      additionalProperties: false
      properties:
        price:
          type: number
        quantity:
          type: integer
        sku:
          type: string
      title: Item
  paid:
    type: boolean
  status:
    type: string
  tags:
    type: array
    items:
      type: string
  total:
    type: number
title: Root

The date became format: date-time, the customer and the line items got schemas of their own (Customer, Item), and coupon, which was null in the example, is only nullable: one example does not say what type it has when it is set.

What it does not do

  • It reads one example. Fields that are missing from it, and the type of a value that is null in it, cannot be known.
  • It does not mark fields as required, and it adds no enums, lengths, patterns or descriptions.
  • It recognises date-time strings, not e-mail addresses or URLs: those stay type: string.
  • It writes OpenAPI 3.0 style (nullable); adjust null handling for OpenAPI 3.1.
  • It does not generate an example from a schema (the reverse direction).

This tool and APIGit

This toolWith APIGit
A schema for one exampleSchemas in the editor's form editor, reusable across the specs of a repository
Paste it into your spec yourselfImport a HAR file of recorded requests and get an endpoint for each of them
No checkThe validator's rules in the Governance view and in apigit lint
A schema on its ownA mock server that answers with the schema's examples or generated values

Questions and answers

Which schema dialect does it write?
An OpenAPI 3.0 schema in YAML: a null value becomes nullable: true, which is how OpenAPI 3.0 says a value may be null. In OpenAPI 3.1 you would write type: [string, "null"] instead.
How does it pick types and formats?
From the example's values: a whole number becomes integer, a decimal number, a true or false boolean, a timestamp string date-time, other strings string. Nested objects and the objects of an array get a schema of their own, with a title.
Why are no properties required?
One example cannot tell which fields are always present. Add a required list for the fields your API always sends.
Why does every object have additionalProperties: false?
The generator describes exactly the fields of the example. Remove the line where an object may carry more fields, for example a map of settings.
Is my JSON uploaded?
No. The schema is generated in your browser; nothing is sent to APIGit.
Where do I put the result?
Under components.schemas in an OpenAPI file, with a name, and refer to it with $ref from a response or a request body.