Developer ToolJSON SchemaAPI DesignOfflineDeep Prototype

JSON Schema Generator — Sample to Schema

Paste sample JSON or NDJSON. Infers types, detects string formats (email, uri, uuid, date-time, ipv4), recognizes enums from repeated literals, and merges multiple samples into one schema that validates them all.

JSON Schema Generator — Sample to Schema preview
Open live →

What it is

A schema inference tool that walks any JSON document, builds a per-sample schema, and merges multiple samples into one. The result is a valid JSON Schema (draft 2020-12) that validates every input you fed it.

What it does that’s non-trivial

  • Format detection — checks string values against 8 regexes (email, uri, uuid, date, date-time, time, ipv4, ipv6, hostname) and emits the matching format keyword.
  • Sample merging — when you paste an array of objects or NDJSON, every sample contributes. Keys present in all samples become required; keys present in some become optional. String fields with ≤8 distinct literal values across samples become enums automatically.
  • Type unionsnull and string across different samples merges to "type": ["null","string"]. Integer + number merges to number.
  • Nested objects and arrays — fully recursive. Array item schemas merge across all items.
  • Toggle policies — required-detection, format-detection, enum-detection, and additionalProperties are switchable per audit.

Five fixtures pre-loaded: single user record, e-com order with nested customer + items array, audit event with nested metadata, NDJSON of 5 login events (shows enum inference for kind), and a deeply nested tenants tree.

Why a tool

API contract authoring usually goes “we have sample responses, can you write the OpenAPI?” That’s 30 minutes of manual schema-typing per endpoint. This collapses it to a paste. The output is a checked-in starting point — not a final spec, but the boring 80% done before you’ve stopped reading the response.

How it ships

Single HTML file, ~22KB. Zero dependencies. The recursive merger, SPDX-expression handler, format detector, and enum collector are 360 lines of vanilla JavaScript. The output includes a JSON syntax-highlighted preview with copy.

Open the tool →