Calculates on this device. File exports run online.
Data Schema Generator & Validator
Paste sample JSON (or YAML) and get the JSON Schema it follows: types, required properties, formats such as dates and e-mail addresses, and lists. Check data against a schema with every problem and its place, make example or test data from a schema, or write the schema for Avro, OpenAPI, BigQuery, MongoDB, SQL, protobuf or TypeScript.
Enter your values
Check these values
Your values are worked out in this browser. They are not sent to a server.
Your result will show here
Fill in the values, then choose the button below them.
Your result
How it was worked out
How to make a JSON Schema from JSON
- Choose Make a schema from sample data and paste one or more examples of your data, or open a JSON, JSON Lines or YAML file.
- Say how the samples are written: one document, each item of a list, one document on each line (JSON Lines), or YAML.
- Choose the JSON Schema version (Draft 2020-12 is the newest; Draft 7 is still the most widely used) and press Make the schema.
- Copy or download the schema. The table lists each property with its type and whether every sample has it (required).
Check data against a schema
Choose Check data against a schema, paste the schema and the data. Every problem is listed with its place in the data as a JSON pointer (such as /items/2/price), the rule (type, required, enum, pattern, minimum …) and what is wrong. The schema can be JSON Schema (Draft 4, 6, 7, 2019-09 or 2020-12, in JSON or YAML), an OpenAPI 3 or Swagger 2 document, an Avro schema, TypeScript interfaces or SQL CREATE TABLE statements. Data can be JSON, a list of documents, JSON Lines or YAML.
Make example and test data
Choose Make example data from a schema. With one record the page writes a fixed example that uses the examples, defaults and allowed values of the schema; with more it makes up records from a seed (the same seed gives the same records). Every record is checked against the schema again, and records that cannot meet a rule (a pattern, for example) are counted and named.
Convert a schema
- JSON Schema → TypeScript, Avro, OpenAPI 3.0 or 3.1, BigQuery, MongoDB ($jsonSchema validator), SQL CREATE TABLE (PostgreSQL, MySQL, SQLite, SQL Server), Protocol Buffers (proto3) and Markdown documentation.
- OpenAPI or Swagger, Avro, TypeScript interfaces and SQL CREATE TABLE → JSON Schema.
- What the other language cannot say (a pattern in Avro, oneOf in BigQuery …) is listed under the result: nothing is dropped without a word.
- XML Schema (XSD) to and from JSON Schema, an XSD made from sample XML, and an example XML from an XSD are made on the server: use the box below.
Limits you should know
- A schema made from samples can only describe what the samples show: add samples with every optional property, and check the required list.
- References ($ref) are followed inside the schema only; a schema on another web address is not fetched.
- Numbers are JavaScript numbers in the page: whole numbers longer than 15 digits lose digits. The server check (box below) reads them exactly.
- Formats checked in the page: date-time, date, time, email, hostname, ipv4, ipv6, uri, uuid, regex and json-pointer. Others are listed as not checked.
- Classes in Java, C# or Python are not read; TypeScript interfaces are.
Privacy
Schemas and data are read, checked and converted in your browser. Only what you send with a box below goes to the Toolvito server: the files you choose there, and for a check of many files the schema shown above. Download the result within one hour after the job finishes. Choose Delete files now to request earlier removal. The hourly cleanup normally removes files within one to two hours after completion.