Online JSON to TypeScript| Generating type-safe interfaces- GoTool online toolset

开发工具指南

Easily convert JSON data to a type-safe TypeScript interface. Generate code quickly and accurately, improve development efficiency, bid farewell to manual writing, and make your development process smoother!

使用说明

Feature Introduction

  1. Supports parsing nested JSON strings, recursively parsing nested objects.
  2. Supports parsing array JSON strings, parsing the first JSON string in the array.
  3. Checks if the JSON string format is correct and outputs the error location.
  4. Supports line-by-line parsing of comments.

Example

Parsing Nested JSON String

{
    "name": "test", // Name
    "age": 10, // Age
    "addr": "Chengdu, Sichuan", // Address
    "cls_info": [ // Classes
        {
            "name": "Basketball Class", // Class Name
            "teacher": "Mr. Zhang" // Teacher
        },
        {
            "name": "Art Class", // Class Name
            "teacher": "Mr. Li" // Teacher
        }
    ]
}

After processing:

export interface IClsInfo {
    name: string; // Class Name
    teacher: string; // Teacher
}


export interface IGenerateObj {
    name: string; // Name
    age: number; // Age
    addr: string; // Address
    cls_info: IClsInfo[]; // Classes
}