Infer a TypeScript interface from a JSON object.

Result

Run the tool to see the result here

Overview

Turn sample JSON payloads into a quick TypeScript starting point. Perfect for wiring new API clients or sharing data contracts with teammates.

Use Cases

Documenting APIs

Paste API responses to generate TypeScript definitions for SDKs or internal documentation.

Rapid prototyping

Infer types while experimenting in a playground without manually writing interfaces from scratch.

Onboarding teammates

Share generated interfaces to explain object structures when ramping up new developers.

How to Use

  1. Paste valid JSON

    Provide a representative sample object. Arrays will derive their element type from the first item.

  2. Set an interface name

    Adjust the interface name to match your domain model. Optional fields are always included in the result.

  3. Refine manually

    Use the generated interface as a baseline and refine complex unions or nested shapes by hand.

Frequently Asked Questions

Does the tool detect optional properties?

Optionality is not inferred automatically. Every observed property is required so you can decide manually which ones should be optional.

How are arrays handled?

The first element determines the inferred type. Empty arrays default to `unknown[]` so you can refine them afterwards.

Related Tools

External Resources