Toolvist

Generador de JSON Schema

Analiza una muestra de JSON y genera un JSON Schema que describe su estructura y tipos. Generador de esquemas online con salida draft-07 para copiar.

Paste JSON to analyse.

Listo.

Root type

—

Properties

0

Max depth

0

Formats detected

0

Generador de JSON Schema

Pega un documento JSON de muestra y obtén un JSON Schema que lo describe. Los elementos de los arrays se fusionan, así que un esquema construido a partir de una lista de registros captura cada campo, y los formatos de cadena comunes como fechas, correos y UUID se detectan automáticamente.

The generated schema documents what the JSON Validator checks, and the data itself is made readable by the JSON Formatter & Beautifier. For the shape of an API response rather than a document, the GraphQL Formatter is the neighbour.

Cómo usar JSON Schema

  1. 1 Paste a JSON document or an example response.
  2. 2 Choose whether to infer types strictly or permissively.
  3. 3 Generate. The schema describes the structure with required fields and types.
  4. 4 Copy the schema and refine it — inference from one example is a starting point.

Cómo funciona

El generador recorre tu muestra de forma recursiva. Para arrays de objetos fusiona los esquemas de cada elemento, así que los campos que aparecen solo en algunos registros siguen representados y las claves requeridas son las presentes en todos.

  • Salida Draft-07 y 2020-12
  • Fusiona los esquemas de los elementos de los arrays
  • Claves requeridas inferidas entre registros
  • Detección de formato de cadena (fecha, email, URI, UUID)
  • Detección de enum para conjuntos pequeños de valores

Preguntas frecuentes

What is a JSON Schema for?

For describing and validating the shape of JSON documents. It states which fields exist, which are required, what types they hold, and the constraints on their values. It is used to validate API payloads, generate documentation, and produce typed code from the structure.

Why is a single example not enough?

Because it cannot distinguish required from optional fields. A field present in the example might be present in every valid document or might be one of many optional ones, and nothing in one sample tells you which. Fields that happen to be null in the example are similarly ambiguous.

Which draft version should I target?

Whichever the consuming tool supports. The specification has evolved and later drafts changed keywords, so a schema written for a newer draft may not validate correctly against an older validator. Recent drafts are the safer default unless a tool requires otherwise.

Herramientas para desarrolladores relacionadas

Ver todo en Herramientas para desarrolladores →

También te puede interesar

Herramientas de otras categorías que suelen combinarse con JSON Schema:

Explorar el directorio completo →