JSON to TypeScript

Paste a JSON sample and auto-generate interface and type definitions

도구를 불러오는 중…

🔒 Everything runs 100% in your browser. Your files and input are never uploaded to any server.

Paste a JSON sample such as an API response or config file, and this tool automatically generates matching TypeScript interface or type definitions. Nested objects are split into separate types, and keys that appear in only some objects within an array are marked as optional (?) properties.

How to use

  1. Paste the JSON sample you want to convert into the input box.
  2. Set a name for the root type and choose whether to declare it as an interface or a type.
  3. If needed, turn on 'Add export keyword' to make it an exported declaration.
  4. Review the generated type definitions and use 'Copy types' to paste them into your code.

FAQ

Does it handle nested objects and arrays?
Yes. Nested objects are split into separate interfaces, and for arrays of objects it merges the elements' keys into a single type, marking keys that appear in only some elements as optional (?). When a value can be several types, it's expressed as a union (|).
Should I choose interface or type?
For most object shapes, interface is a safe choice since it's easy to extend and merge. Use type if you need union aliases or simply prefer it, and you can regenerate the result at any time.
Is the JSON I enter sent to a server?
No. JSON parsing and type generation all run inside your browser, and nothing you enter is sent to or stored on any server.

← Back to all tools

가격 보기카톡 무료 상담