JSON to JSON Schema

Generate a JSON Schema from any JSON sample, with required fields, nested definitions and integer detection. Free and private.

How to convert JSON to JSON Schema

  1. Paste a JSON object or array, for example a response from the API you are calling.
  2. Set the name of the root type.
  3. Copy the generated JSON Schema code into your project.

What you get

Tips for accurate results

The generator only knows the sample you paste. Include arrays with several items and responses where optional fields are present, so it can tell which keys are always there, which can be null and which numbers have decimals.

Frequently asked questions

Is my JSON sent to a server?

No. The code is generated in your browser, so API responses and other private data never leave your device.

What is JSON Schema used for?

It describes the shape of JSON documents. It is used to validate API requests and responses, document APIs in OpenAPI, power editor autocompletion for config files and generate forms.

Which fields are marked as required?

Every key present in all samples is required. When an array contains several objects, keys that appear in only some of them are left out of required.

Can I validate data with the generated schema?

Yes. Any validator that supports draft 2020-12 works, for example Ajv in JavaScript or jsonschema in Python. Review the schema first: a sample only shows the values it contains.