TypeScript interface
→ JSON sample
Paste any TypeScript interface and get a realistic JSON sample instantly. No writing fixtures by hand, no guessing field values, no signup.
Paste your interface
Interface → JSON Sample
Paste TypeScript interfaces. TypeMorph instantly generates a representative JSON sample.
// JSON sample will appear hereThe problem it solves
You have TypeScript interfaces. You need JSON — for tests, for mocking an API response, for Storybook args, for documenting an endpoint. The options are all slow:
- •Write fixtures by hand, then keep them in sync as types change
- •Ask a colleague what a real response looks like
- •Dig through network logs hoping to find a real example
- •Wire up faker.js and spend 20 minutes mapping every field
TypeMorph reads the field names in your interface and generates a plausible value for each one. An email field gets an email address. A created_at field gets an ISO timestamp. The output is ready to paste into a test or a mock handler.
In CI — keep fixtures in sync with your types
# Generate a JSON sample from a TypeScript file typemorph reverse src/types/user.ts # Pipe to a fixture file typemorph reverse src/types/user.ts > fixtures/user.json # Read from stdin cat src/types/user.ts | typemorph reverse
The CLI command reads your TypeScript source and writes JSON to stdout. Pipe it into a fixture file and your test data automatically reflects the latest shape of your types.
FAQ
What does "Reverse" mean in TypeMorph?
The main TypeMorph workflow is JSON → types. Reverse flips it: you give TypeMorph a TypeScript interface and it produces a JSON sample that matches the shape. Useful when you have types but need data.
Does the TypeScript source get sent to a server?
No. Generation runs entirely in your browser — no server, no API keys, no retention. Your types never leave your machine.
How are field values chosen?
TypeMorph uses field names as semantic hints: a field named "email" gets a plausible email address, "id" gets a UUID, "created_at" gets an ISO timestamp. Number fields get small positive values; booleans default to true.
Can I use this in a test suite or CI?
Yes — use the typemorph-cli reverse command to generate fixture files from your types in a build step. Point it at your types and pipe the output to a .json file so fixtures stay in sync as your types evolve.