Monu Tools

JSON to TypeScript

JSON 샘플에서 중첩 타입, 배열, 선택적 필드가 포함된 TypeScript 인터페이스를 생성합니다. 브라우저에서 실행됩니다.

JSON to TS 사용 방법

  1. 01

    JSON 객체나 배열을 붙여넣으세요.

  2. 02

    선택적으로 루트 인터페이스 이름을 설정하세요.

  3. 03

    생성된 TypeScript 인터페이스를 복사하세요.

What the generator does

This is a JSON to TypeScript generator that infers a set of interfaces from an example JSON object or array, so you can paste an API response and get ready-to-use types instead of writing them by hand.

It is a big time-saver when you are consuming an API or a config file: paste a response, optionally name the root interface, and copy clean TypeScript straight into your code.

Generation runs entirely in your browser, so your data never leaves your device, which matters when the sample contains real values.

How it handles real-world shapes

It handles real-world shapes: nested objects become their own named interfaces referenced from the parent, arrays of objects are merged into one interface, and union types are produced where values vary.

Optional fields across mixed arrays

When the objects in an array do not all have the same keys, the keys missing from some elements are marked optional with a question mark, which matches how the data actually behaves and keeps the types honest.

It infers, it does not enforce a schema

One important point: it infers a shape from the single sample you give it, rather than enforcing a schema. If a field is sometimes null or absent in real data but not in your sample, the generated type will not know that, so use a representative example.

자주 묻는 질문

중첩 객체는 어떻게 처리되나요?

각 중첩 객체가 별도의 명명된 인터페이스가 되고 부모에서 참조됩니다. 결과가 깔끔하고 재사용 가능합니다.

형태가 다른 배열은 어떻게 되나요?

객체 배열은 하나의 인터페이스로 병합되고 일부 요소에서 누락된 키는 선택적으로 표시됩니다. 혼합된 원시 타입의 배열은 유니온 요소 타입이 됩니다.

JSON이 어딘가에 업로드되나요?

아니요. 타입은 브라우저에서 완전히 생성되므로 데이터가 기기 밖으로 나가지 않습니다.

출처

이 도구 임베드하기

이 도구를 직접 운영하는 웹사이트에 추가하세요. 아래 코드를 복사하면 자동으로 최신 상태로 유지됩니다.

<iframe src="https://monu.tools/embed/ko/json-to-typescript" width="100%" height="640" style="border:1px solid #e5e5e5;border-radius:12px;max-width:680px" loading="lazy" title="Monu Tools"></iframe>

관련 도구