FormatForge logoFormatForge

JSON and API Tools

JSON Schema Generator Online Free

Generate JSON Schema from JSON online. Paste sample JSON and create a schema for API validation, backend models, OpenAPI workflows and data contracts.

JSON Schema workspace

Infer Draft 2020-12 structure, required fields and common string formats from sample JSON.

Valid JSON · inferred 10 schema type nodes · email/URI/date formats detected when recognizable.

Sample JSON

Generated JSON Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "GeneratedSchema",
  "type": "object",
  "properties": {
    "id": {
      "type": "number"
    },
    "name": {
      "type": "string"
    },
    "active": {
      "type": "boolean"
    },
    "email": {
      "type": "string",
      "format": "email"
    },
    "website": {
      "type": "string",
      "format": "uri"
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "owner": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "required": [
        "name"
      ]
    }
  },
  "additionalProperties": false,
  "required": [
    "id",
    "name",
    "active",
    "email",
    "website",
    "tags",
    "owner"
  ]
}
Inference is based on the supplied sample. Review optional fields, numeric ranges, enums, array item variations and business validation rules before using the schema in production.

API contract guide

Generate a useful starting schema—not a final contract

A generated JSON Schema infers types and properties from the sample you provide. One sample cannot reveal every valid alternative, required-field rule, format or business constraint. Treat generated output as a starting point, then review required fields, nullability, arrays, numeric ranges, enums and additional-property behaviour.

Browser processing
No account required
Free to use
Developer friendly

Step-by-step

A reliable workflow

1

Paste representative valid JSON.

2

Generate the draft schema.

3

Review types, required fields, arrays and nested objects.

4

Add domain constraints and test valid and invalid examples.

Data transformation

Preserve structure, types and business meaning

Converting structured data is not only a formatting task. Arrays, nested objects, dates, numbers, null values and duplicate keys may map differently between JSON, CSV, XML, YAML and spreadsheets. A successful export should preserve the meaning needed by the destination system, not merely create a file that opens.

Data types

Numbers, booleans, dates and nulls can become plain text when moved into loosely typed formats.

Nested structure

Tabular formats require flattening, multiple sheets or repeated rows to represent nested arrays and objects.

Schema expectations

Valid syntax does not guarantee that required fields, allowed values or relationships are correct.

Character encoding

UTF-8 handling is essential for names, symbols and multilingual data.

What the operation can change

  • Flattening can turn nested paths into column names.
  • CSV cannot natively preserve objects, arrays or strong data types.
  • Spreadsheet software may reinterpret identifiers, dates and leading zeros.
  • Round trips between formats may not reproduce the original structure exactly.

Domain-specific verification

  • Compare record counts and required field counts.
  • Inspect leading zeros, large numbers, dates, nulls and Unicode text.
  • Validate against a schema or import a small sample into the destination system.
  • Keep the original source file and document any flattening convention used.

Before processing

Input checks that prevent bad conversions

  • 01Use several representative records instead of generating a schema from one ideal example.
  • 01Include null, optional, empty and exceptional values that appear in real payloads.
  • 01Redact confidential values while preserving their data types and structural position.

After processing

Verify the result before integration

  • Review required fields, nullable values, array item types and numeric constraints.
  • Test both known-valid and deliberately invalid payloads against the schema.
  • Confirm the selected JSON Schema draft is supported by the intended validator.

Troubleshooting

Common conversion failures

Optional fields became required

Generate from multiple varied samples or edit the required list manually.

A field has the wrong type

The sample set may not include all legitimate values; add representative examples and review unions.

Validation differs between systems

Check schema draft support, format validation settings and vendor-specific extensions.

Practical use cases

API validation

Create an initial contract for request and response payloads.

Event messaging

Describe messages used by queues and event streams.

Documentation

Explain nested data structures to consumers.

Test generation

Build positive and negative validation cases.

Common mistakes

  • Generating from only one unusually complete sample
  • Marking every observed property as required
  • Forgetting null values and optional fields
  • Not selecting the schema draft supported by the target validator

Professional tips

  • Use several representative samples
  • Add formats only when consumers enforce them
  • Decide whether unknown properties are allowed
  • Version schemas with API or event contracts

Continue the workflow

Frequently asked questions

Can a generator know which fields are required?+

It can infer from a sample, but only domain knowledge and multiple examples can establish true required-field rules.

What happens with null values?+

A field observed as null may need a union type or a clearer rule based on other samples.

Can JSON Schema validate business logic?+

It handles many structural constraints, but cross-record and application-specific rules may require custom validation.

Which schema draft should I use?+

Use the draft supported by your chosen validator and platform, and declare it explicitly.

Should additional properties be allowed?+

That is a compatibility decision. Strict contracts catch unknown fields, while permissive contracts can ease evolution.

Can I use JSON Schema with OpenAPI?+

OpenAPI uses a schema vocabulary related to JSON Schema, with version-specific differences that should be checked.

Is my data uploaded to a server?+

The supported FormatForge data tools process input in your browser. Avoid pasting secrets, production credentials or personal data into any online utility.

Can I use the tool on mobile?+

Yes. For large files, deeply nested data or long configuration files, a desktop browser normally provides more memory and a better editing area.

What should I do before using converted output?+

Validate the result, compare representative records and test it in a non-production environment before using it in an application, pipeline or deployment.

Why can large files take longer?+

Parsing, flattening, validating and rendering large nested structures uses your device memory and processor.