When to use it
When all you have of an API is a sample response — no schema, no TypeScript SDK. Hand-typing the interface tends to miss fields.
Inference rules
- Objects — fields are inferred recursively, and identical shapes are reused under the same interface name.
- Arrays — element types are merged into a union. An empty array
becomes
unknown[]. - null — default is
T | null. Toggling Treat null as optional rewrites those fields asfield?: Tinstead. - Primitives — string, number, boolean.
Options
- Root interface name — defaults to
Root. Pick whatever fits the model you're describing. - Add export — emits
export interface …. - Treat null as optional — clearer in strict-null-check codebases.
Limits
- Polymorphic responses (the same field varying type across calls) can't be inferred from one sample. Merge a few payloads by hand if you need a union.
- Non-JSON values (functions, symbols, BigInt) aren't part of the source format and are ignored.
Where does your input go?
JSON analysis and TypeScript interface generation happen in your browser. Your data is never uploaded or stored.