홈
Tom Utilities

JSON을 TypeScript로

JSON 도구

선택적 타입과 유니온 타입을 지원하는 TypeScript 인터페이스를 JSON 샘플에서 생성합니다.

입력

결과

사용 방법

Generating TypeScript interfaces

Paste a JSON sample and press Convert to obtain interfaces. Union types are produced for mixed arrays.

  1. Paste a JSON sample.
  2. Press Convert.
  3. Copy the interfaces into your project.

자주 묻는 질문

Are fields marked optional?

Fields missing from the sample are not inferred, so optionality is only added when a value is null.

How are arrays typed?

Homogeneous arrays use a single type, mixed arrays produce a union type and empty arrays produce unknown[].