# Generatore di schema Zod da JSON

> Deduci una bozza di schema di runtime con controlli di opzionalità.

[Open tool](https://www.toolcabana.com/it/json-to-zod-schema-generator) · [Utilità per sviluppatori](https://www.toolcabana.com/it/category/developer-utilities)

Tool ID: json-to-zod-schema-generator. Requested language: it. Description language: it. Complete guide translation: yes.

## Overview (en)

The JSON to Zod schema generator takes one JSON example and returns TypeScript code that imports z from zod and exports a schema constant inferred from the example. Strings, numbers, booleans, null, nested objects and arrays are mapped to Zod types, with z.union for mixed arrays. You can rename the constant and mark every object property optional.

## Supported tasks (it)

Deduci una bozza di schema di runtime con controlli di opzionalità.

## Steps (it)

1. Incolla l'origine nell'editor di input, oppure carica l'esempio integrato.
2. Regola le impostazioni di base, poi apri la modalità avanzata per le opzioni di esportazione e ottimizzazione. Le impostazioni personalizzate restano attive quando il pannello è chiuso.
3. Esegui il generatore di schema Zod da JSON, esamina il risultato, poi usa i controlli disponibili per copiare o scaricare.

## Settings

- Nome della costante dello schema (it; key: name; type: text)
- Rendi opzionali le proprietà degli oggetti (it; key: optional; type: checkbox)

## Limitations (it)

Gli input CSV/XLSX sono limitati a 10 MB ciascuno, 200 colonne e 20.000 righe; l'output unito è limitato a 20.000 righe. La valutazione di script e filtri JSONPath è disabilitata. Le altre operazioni applicano i controlli visibili e i limiti di testo.

## Example input

```text
{"name":"Alex","age":30,"active":true,"tags":["tools"]}
```

## 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 are arrays converted to Zod schemas?

Each element type is inferred and duplicates are merged. An array of one type becomes z.array(z.string()), mixed element types become z.array(z.union([...])), and an empty array becomes z.array(z.unknown()) because there is nothing to infer from.

### How do I make all fields optional in the generated schema?

Turn on Make object properties optional. Every property in every object, including nested ones, gets .optional() appended. Without it, each property found in the example is required. Edit the code afterward if only some fields should be optional.

### Why should I review the generated Zod schema?

The schema is inferred from a single example, so it cannot know which fields are sometimes missing, which strings are emails or enums, or what number ranges are valid. Add refinements such as .email() or .min() yourself. Nesting is limited to 30 levels.

### 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?

Gli input CSV/XLSX sono limitati a 10 MB ciascuno, 200 colonne e 20.000 righe; l'output unito è limitato a 20.000 righe. La valutazione di script e filtri JSONPath è disabilitata. Le altre operazioni applicano i controlli visibili e i limiti di testo.

## Related tools

- [JSONPath explorer](https://www.toolcabana.com/it/jsonpath-explorer)
- [cURL to fetch converter](https://www.toolcabana.com/it/curl-to-fetch-converter)
- [Unix permissions calculator](https://www.toolcabana.com/it/unix-permissions-calculator)
- [Semver range tester](https://www.toolcabana.com/it/semver-range-tester)
