Como usar: JSON to JSON Schema
- Paste a JSON example — an API response, a config file, a database record — or click Sample.
- For better results paste several examples as a JSON array: fields missing from some become optional, and different types become a union.
- Choose the draft, how required is decided, and whether to detect formats, build enums, forbid extra properties or keep examples.
- Copy or download the schema — or send it straight to the JSON Schema to TypeScript converter or the validator.
How the schema is inferred
- Types: strings, numbers, integers (whole numbers), booleans, null, objects and arrays. A field that is sometimes a number and sometimes null becomes
"type": ["number", "null"]. - Arrays: every item is merged into one
itemsschema, so an array of user objects gets one user schema with all keys seen. - Required: by default a key is required only if it appears in every object of that shape. With one example, all keys are required.
- Formats: strings that all look like an email, URI, UUID, date, date-time, time, IPv4 or IPv6 get a
format. - Enums: a string field with a few repeating values across many examples (like
status) becomes anenum.
An inferred schema describes your examples, not your intent — review it: tighten strings with minLength or pattern, add minimum/maximum to numbers and decide which fields are truly optional. Then check data against it with the JSON Schema Validator or generate types with JSON Schema to TypeScript.
Também pesquisado como: json schema generator, generate json schema from json, infer json schema, json schema from example, create json schema online, json schema draft 2020-12, json to schema.
Ferramentas que combinam com: JSON to JSON Schema
- JSON to TypeScript — Paste a JSON sample — an API response, a config — and get ready-to-use TypeScript interfaces with nested types, optional properties and union types.
- Formatação JSON — Cole o JSON aqui para formatá-lo, compactá-lo ou validá-lo.
- OpenAPI / Swagger Validator — Paste an API specification to check it against the official OpenAPI schema, catch broken references and inconsistent path parameters, and see every endpoint at a glance.
- Gerador de dados simulados — Crie até 10.000 linhas de dados de teste realistas — usuários, produtos, pedidos, endereços, empresas ou registros de API aninhados — ou crie seu próprio esquema.