JSON to TypeScript
Paste JSON and get TypeScript interfaces, including nested objects and arrays
Instructions
JSON 转 TypeScript 接口使用说明
功能简介
拿到一份接口返回的 JSON,要手写 TypeScript 类型很费时间。这个工具直接读 JSON 结构,递归推断出嵌套的 interface。
使用方法
注意事项
❓ FAQ
What if the object types in an array are inconsistent?
The tool generates one interface for each distinct structure and writes the array element type as a union, for example `(User | Admin)[]`. You can narrow it down after generation based on your actual business logic.
Why is the type of a null field null?
Because there is only this one piece of data, it is impossible to tell whether it will be a string or a number later. It is recommended to add all the types that have appeared in real data, or manually change it to `string | null`.
Does it support generating Go or Java types?
Currently it only generates TypeScript. If you want to see the structure first, the nested interface names inferred by this tool are not hard to rewrite as structs in other languages.
🔗 Related Tools
📝 Related Articles
How to Use a Countdown Timer: Complete Steps from Setting to Ringing
This guide breaks down how to use a countdown timer into actionable steps, covering duration setting, start/pause, ring troubleshooting, phone mute and background restrictions, maximum duration limits, and the trade-offs between online and system timers, with developer API debugging points included—read it and you can start using it right away.
tool-tutorialsHow to Use a Running Pace Calculator? Enter Distance and Time to Get Your Pace per Kilometer
Want to know how long it takes you to run each kilometer? Just enter distance and total time to instantly get pace, speed, and split references. You can also troubleshoot common issues like wrong units, result deviations, and the calculator not opening on mobile—helping beginners quickly establish their own training baseline.
tool-tutorialsHow to Use JS Formatter and Minifier: Beginner Step-by-Step Guide
Use a browser-local JS formatter and minifier to restore a script minified into one line back to a readable structure, or remove whitespace and comments to reduce size—all without uploading code. This article provides step-by-step operations, error troubleshooting, API debugging, and large file handling methods—follow along and you can independently complete a formatting or minification task.
tool-tutorialsHow to Use English Case Conversion: Beginner Step-by-Step Guide
Paste English text into an online tool, choose the case mode, and complete the conversion with one click. This article provides the complete step-by-step operation, methods for mobile and large file handling, usage in API debugging scenarios, and troubleshooting ideas when conversion fails, helping you learn English case conversion in a few minutes and avoid common pitfalls such as abbreviations, line breaks, and mixed Chinese-English text.