ToolHuts
JSON tools

JSON to TypeScript

Generate TypeScript types from JSON samples or a supported JSON Schema. We merge every sample, preserve nullable fields, and keep your data in your browser.

For multiple samples, put a line containing --- between complete JSON documents. Missing fields become optional; null stays a separate union member.

We process your text in your browser without uploading or saving it.

What the output means

We generate named interfaces for nested objects by default; choose inline types for a single declaration. Valid TypeScript identifiers stay unquoted, and other keys keep their exact spelling in quotes. Choose Array<string> or string[] syntax. Arrays combine all observed element types; empty arrays use unknown. Missing properties become optional across samples, but one sample cannot prove a field is required. JSON numbers become number; JavaScript parsing can round integers beyond 9,007,199,254,740,991. Duplicate JSON keys use the last value.

Schema support

We support type (including nullable type arrays), properties, required, items, primitive enum and const, and boolean additionalProperties. Use enum and const as standalone primitive constraints; combining them with type or structural constraints produces an error. Unsupported keywords such as $ref, oneOf, format and minimum produce an error. TypeScript checks structure, not runtime data or exact object keys. Additional properties use an unknown index signature. Use a runtime validator for constraints.

Why use this instead of a chat prompt?

Paste several real responses, inspect one deterministic result immediately, and download the same types without sending samples to a chat service.

Updated 22 November 2026 · Built by the ToolHuts team.

Explore JSON converters