QodeCat Menu
All tools
JSON FormatterSQL FormatterChmod CalculatorJWT DecoderBase64 ConverterURL ParserDiff CheckerUUID GeneratorCron GeneratorTimestamp ConverterCSV to JSONRegex TesterYAML to JSONJWT GeneratorJSON to TypeScript

© 2026 QodeCat Studio

QodeCat
Guides
QodeCatBeta

Free developer tools for everyday tasks. Built with privacy and performance in mind.

© 2026 QodeCat Studio. All rights reserved.
Privacy PolicyTerms of ServiceGuidesContact Support
Made within Turkey 🇹🇷

Loading tool…

Turn a JSON Response Into Types

Typing an API response by hand is slow and easy to get wrong. Paste a real JSON sample and QodeCat writes the TypeScript declarations for you, live as you type, ready to copy into your project.

  • Named nested types: Every nested object becomes its own interface, named after its key.
  • Optional fields: A key that is missing in some items of an array is marked with ?.
  • Unions: Mixed arrays become union types, null values become T | null and empty arrays become unknown[].
  • Options: Root name, interface or type alias, readonly properties and the export keyword.

Why use this tool?

Learns From All Array Items

Instead of looking only at the first element, the generator merges every object in an array. Keys that appear only sometimes become optional, and a field that is a string in one item and null in another becomes string | null.

Clear Errors, Private Data

If the JSON is invalid, you see the line and column of the problem. The conversion runs entirely in your browser, so API responses with customer data or tokens are never uploaded.

Frequently Asked Questions

Q. What happens to keys that are not valid identifiers?

Keys like "first-name" or "2fa" are written in quotes, which is valid TypeScript. Interface names are built from the key in PascalCase, for example WithSpace for "with space".

Q. Are identical nested objects merged into one type?

Yes. If two keys hold objects with exactly the same structure, the generator declares one interface and uses it for both, so the output stays short.

Q. Should I choose interface or type?

Both describe the same shape. Interfaces can be extended and merged, type aliases are handy for unions. Pick the style your project already uses; the option switches all declarations at once.