PocketPlay
中文

JSON Schema Generator

Turn sample JSON into a JSON Schema — types, required keys, enums and string formats inferred automatically.

🔒 Runs in your browser — files never leave your deviceFree · No sign-up

Sample JSON

Generated schema

Options

A key is required only when it appears in every sample object. Feed an array of several records so optional keys and enums can be spotted.

How to use the JSON Schema generator

  1. Paste your sample JSON on the left — an array of several records gives a far better schema than a single object.
  2. Pick draft-07 or 2020-12 and switch enum, format and required options on or off; the schema regenerates as you type.
  3. Copy the schema or download it as a .schema.json file for your validator, OpenAPI spec or code generator.

FAQ

How does it decide which keys are required?

When the root is an array, every object in it is merged: a key lands in required only if it appears in all of them. With a single object every key is required, which is usually too strict — feed a few records instead, or untick the options you disagree with.

When does it emit an enum?

When a string or number field has at most the configured number of distinct values (5 by default) and those values repeat across records, so a one-off free-text field is not mistaken for a fixed set. Raise or lower the limit, or turn enum detection off entirely.

Is my JSON uploaded anywhere?

No. The sample is parsed and the schema is built entirely in your browser — nothing is sent to a server, so you can safely paste production payloads.