JSON → JSON Schema

Infer a JSON Schema from a sample document.

Private by design. Your input never leaves this browser. Conversions run locally on your device.

What this tool handles

  • Emits draft-07 or 2020-12.
  • Required lists the keys that appear in every observed object.
  • additionalProperties can be pinned to false.
  • Arrays are typed from their first element.

Example

JSON sample

[{"id":1,"name":"Ada"},{"id":2,"name":"Linus"}]

JSON Schema

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "integer"
      },
      "name": {
        "type": "string"
      }
    },
    "required": [
      "id",
      "name"
    ]
  }
}

Related tools

  • JSON → TypeScript — Generate TypeScript interfaces or types from a JSON sample.
  • JSON → Zod — Generate a Zod schema from a JSON sample.
  • JSON → Python — Generate Python dataclasses from a JSON sample.
  • JSON → Go — Generate Go structs with json tags from a JSON sample.
  • JSON → SQL — Generate a CREATE TABLE statement from flat JSON rows.
  • Convert any format — Pick an input format and an output format and convert between any pair.

Browse all 25 tools