JSON Parser

JSON Schema Generator & Validator Online

Paste a JSON document and get a JSON Schema (Draft-07) for it in one click, then copy or download it. Switch to Validate mode to check JSON against any schema and see exactly which fields fail. It all runs in your browser, so your data stays private.

How to generate a JSON Schema from JSON

  1. Paste your JSON (or load the sample). The schema appears as you type.
  2. Review it, then Copy or Download the schema file.
  3. Click Validate with this to switch to Validate mode with the generated schema loaded, and test other JSON against it.

What is JSON Schema?

JSON Schema is a standard way to describe the shape of JSON: which properties exist, what type each one has, which are required, and what values are allowed. Teams use it to validate API requests and responses, check configuration files, document data contracts and generate forms and code. A longer introduction is in What is JSON Schema and why it matters.

Example: JSON in, schema out

{
  "id": 1,
  "name": "Alice",
  "tags": ["admin"],
  "address": { "city": "New York" }
}

produces:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "GeneratedSchema",
  "type": "object",
  "properties": {
    "id": { "type": "number" },
    "name": { "type": "string" },
    "tags": { "type": "array", "items": { "type": "string" } },
    "address": {
      "type": "object",
      "properties": { "city": { "type": "string" } },
      "required": ["city"]
    }
  },
  "required": ["id", "name", "tags", "address"]
}

What the generator infers (and what it doesn't)

  • Types: string, number, boolean, null, object and array. Whole numbers and decimals both become number.
  • Required: every property present in your sample is marked required.
  • Arrays: the item schema is taken from the first element, so put a representative item first.
  • Not inferred: formats (email, date-time), enums, minimum/maximum, string patterns and additionalProperties. They can't be known from one sample, so add the ones you need by hand.

Making the schema stricter

After generating, the most useful edits are:

KeywordWhat it doesExample
requiredLists properties that must be present. Remove optional ones."required": ["id", "name"]
formatChecks a string format: email, uri, date, date-time, uuid."format": "email"
enumAllows only listed values."enum": ["admin", "user"]
minimum / maximumNumber range."minimum": 0
minLength / patternString length and regex."minLength": 3
additionalPropertiesReject unknown fields with false."additionalProperties": false
uniqueItemsNo duplicate array items."uniqueItems": true

Validating JSON against a schema

In Validate mode, paste the schema and the JSON and you get a list of errors with the path to each one, such as a missing required property, a wrong type, a number out of range or a string that fails its format. For full Draft-07 support including $ref, oneOf, anyOf and allOf, use the JSON Schema Validator, which is powered by Ajv.

Related tools

Generate typed code from the same JSON with JSON to TypeScript, JSON to Java or JSON to Go. Compare two payloads with JSON Diff, fix broken input with JSON Repair, or query data with JSONPath.

Handles JSON files up to 20MB smoothly