JSON1 / JSON Schema to JSON
JSON Schema to JSON
Generate a sample JSON document from a JSON Schema. Enums, defaults, and formats produce realistic values, and local $ref pointers are resolved.
Converted output appears here as you type.
Good to know
- Local $ref pointers (#/…) are resolved; remote refs are not fetched.
- Validation constraints such as pattern or minLength are not synthesised — the sample uses plain placeholders.
About this tool
The reverse direction: given a JSON Schema, produce one document that validates against it. The use is fixtures and mocks — a concrete example for documentation, a payload to seed a test, or a quick check that a schema you wrote admits what you meant it to admit.
Values are chosen deterministically. const wins, then the first enum entry, then default, then the first of examples; failing all of those, a placeholder follows the type — strings honour a recognised format like date-time or email, numbers take minimum if one is set, objects fill in every property, and arrays hold a single item.
- How are
$refpointers handled? - Local pointers like
#/definitions/Addressand#/$defs/Addressare resolved against the document itself. Remote refs are not fetched — nothing leaves the browser — so a schema that depends on one reports it as an error instead of silently guessing. - What about
oneOf,anyOf, andallOf? oneOfandanyOftake the first option, which is a valid choice by definition.allOfmerges its branches when they all produce objects, the same way a validator intersects them.- Why does my
patternorminLengthstring not match? - Synthesising a string that satisfies an arbitrary regular expression is a problem of its own, and this tool does not attempt it — the sample uses plain placeholders. Treat the output as a structural skeleton and fill in constrained fields where the exact value matters.
- What happens with a recursive schema?
- The cycle is detected and the recursive branch comes out as
nullrather than looping forever. A linked-list schema, for example, produces a node whosenextis null — one level of the structure, which is usually what a fixture needs.
Related tools
- JSON to JSON SchemaGenerate a JSON Schema from a JSON sample. Every array element is inspected, so optional and nullable fields are detected, not guessed.
- JSON to YAMLConvert JSON to YAML. Strings that would otherwise read as booleans, numbers, or nulls are quoted so the result parses back to the same value.
- JSON to SwiftGenerate Swift structs conforming to Codable from a JSON sample. CodingKeys are emitted only when a key differs from its property name, so simple models stay readable.