# Da JSON a TypeScript

> Deduce un tipo TypeScript da un esempio JSON.

[Open tool](https://www.toolcabana.com/it/json-to-typescript) · [Sviluppo e dati](https://www.toolcabana.com/it/category/developer-and-data)

Tool ID: json-to-typescript. Requested language: it. Description language: it. Complete guide translation: yes.

## 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 (it)

Deduce un tipo TypeScript da un esempio JSON.

## Steps (it)

1. Digita o incolla il testo di origine, oppure carica un esempio.
2. Modifica le impostazioni di base o apri la modalità avanzata per ottimizzare il risultato.
3. Esamina e copia o scarica il risultato. Metti in pausa i risultati in tempo reale per eseguire manualmente. Origini o singole impostazioni superiori a 20.000 caratteri richiedono un'esecuzione esplicita.

## Settings

- Nome del tipo radice (it; key: name; type: text)

## Limitations (it)

Le operazioni di testo accettano in genere fino a 2.000.000 di caratteri. Parser, generatori e formule singoli applicano limiti aggiuntivi mostrati dai relativi controlli.

## Example input

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

## Privacy and connections (it)

Questa operazione elabora i dati di origine nel tuo browser. Copia e download sono azioni esplicite; l'input di origine non viene salvato in un account né in una cronologia.

## Questions (it)

### 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[].

### Dove viene elaborato il mio input?

Questa operazione elabora i dati di origine nel tuo browser. Copia e download sono azioni esplicite; l'input di origine non viene salvato in un account né in una cronologia.

### Quali sono i limiti di input?

Le operazioni di testo accettano in genere fino a 2.000.000 di caratteri. Parser, generatori e formule singoli applicano limiti aggiuntivi mostrati dai relativi controlli.

## Related tools

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