# JSON to TypeScript

> Infer a TypeScript type from a JSON example.

[Open tool](https://www.toolcabana.com/ko/json-to-typescript) · [개발과 데이터](https://www.toolcabana.com/ko/category/developer-and-data)

Tool ID: json-to-typescript. Requested language: ko. Description language: en. Complete guide translation: no; untranslated sections use English.

## Overview (en)

JSON to TypeScript infers a TypeScript type from a JSON example and outputs it as a single exported type alias with a name you choose. Nested objects become inline object types, arrays become Array types with a union of element types, and empty arrays become unknown[]. Optional fields cannot be detected from a single example.

## Supported tasks (en)

Infer a TypeScript type from a JSON example.

## Steps (en)

1. Type or paste your source, or load an example.
2. Change the basic settings or open Advanced mode to fine-tune the result.
3. Review and copy or download your result. Pause Live results to run manually. Sources or individual settings above 20,000 characters require an explicit run.

## Settings

- Root type name (en; key: name; type: text)

## Limitations (en)

Text operations generally accept up to 2,000,000 characters. Individual parsers, generators and formulas apply additional limits shown by their controls.

## Example input

```text
{"name":"ToolCabana","count":2}
```

## Privacy and connections (en)

This operation processes its source in your browser. Copy and download are explicit actions; source input is not saved in an account or history.

## Questions (en)

### How do I generate a TypeScript type from JSON?

Paste a JSON example, set the Root type name, and run the tool. The result is an export type declaration describing every property and nested value in the example.

### Does JSON to TypeScript detect optional properties?

No. The type is inferred from the single example given, so every key present is required and keys that are absent cannot be inferred. Edit the type to add optional markers.

### How are arrays with mixed values typed?

The element types are combined into a union, so an array holding strings and numbers becomes an Array type of string | number. An empty array becomes unknown[].

### Where is my input processed?

This operation processes its source in your browser. Copy and download are explicit actions; source input is not saved in an account or history.

### What are the input limits?

Text operations generally accept up to 2,000,000 characters. Individual parsers, generators and formulas apply additional limits shown by their controls.

## Related tools

- [JSON to Dart model](https://www.toolcabana.com/ko/json-to-dart)
- [JSON to Excel](https://www.toolcabana.com/ko/json-to-excel)
- [Excel to JSON](https://www.toolcabana.com/ko/excel-to-json)
- [XML to JSON](https://www.toolcabana.com/ko/xml-to-json)
