# JSON en TypeScript

> Déduit un type TypeScript à partir d'un exemple JSON.

[Open tool](https://www.toolcabana.com/fr/json-to-typescript) · [Développement et données](https://www.toolcabana.com/fr/category/developer-and-data)

Tool ID: json-to-typescript. Requested language: fr. Description language: fr. 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 (fr)

Déduit un type TypeScript à partir d'un exemple JSON.

## Steps (fr)

1. Saisissez ou collez votre source, ou chargez un exemple.
2. Modifiez les paramètres de base ou ouvrez le mode avancé pour affiner le résultat.
3. Vérifiez puis copiez ou téléchargez votre résultat. Suspendez les résultats en direct pour lancer le calcul manuellement. Les sources ou paramètres individuels de plus de 20 000 caractères nécessitent un lancement explicite.

## Settings

- Nom du type racine (fr; key: name; type: text)

## Limitations (fr)

Les opérations sur le texte acceptent généralement jusqu'à 2 000 000 caractères. Les analyseurs, générateurs et formules individuels appliquent des limites supplémentaires indiquées par leurs contrôles.

## Example input

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

## Privacy and connections (fr)

Cette opération traite sa source dans votre navigateur. La copie et le téléchargement sont des actions explicites ; la saisie source n'est enregistrée ni dans un compte ni dans l'historique.

## Questions (fr)

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

### Où ma saisie est-elle traitée ?

Cette opération traite sa source dans votre navigateur. La copie et le téléchargement sont des actions explicites ; la saisie source n'est enregistrée ni dans un compte ni dans l'historique.

### Quelles sont les limites de saisie ?

Les opérations sur le texte acceptent généralement jusqu'à 2 000 000 caractères. Les analyseurs, générateurs et formules individuels appliquent des limites supplémentaires indiquées par leurs contrôles.

## Related tools

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