Skip to content

JSON to TypeScript Interface

Paste any JSON sample and get a matching TypeScript interface. Nested objects become nested interfaces, arrays infer element types, mixed null / undefined / missing fields become optional. Output is ready to paste into your code.

When to use this

Use when: writing TypeScript code that consumes an API response (paste sample, get the type), reverse-engineering type definitions for a vendor API, migrating an untyped Node.js codebase to TypeScript, generating types from JSON test fixtures.

Frequently Asked Questions

How does it handle null and missing fields?

Fields that appear in some samples but not others become optional (`field?: type`). Fields with null values get `field: string | null`. Provide multiple JSON samples for the best inference - the generator unions / optionals across all samples.

Powered by JSON to TypeScript.

Other targeted versions of this tool — each tuned for a specific use case.

Or use the main JSON to TypeScript if your use case isn't covered above.