JSON to Zig Struct
Paste a JSON document or several samples and zigshape produces an idiomatic Zig struct.
Fields missing from some samples become ?T = null; integer widths fit the observed range.
Smallest int widths from observed range; auto enum suggestion; missing/null become optional.
or drop files
Fetched and dropped content stays in your browser.
Zig
Diagnostics (1)
Field decisions
struct User $
- Alternatives:
- Alternatives:
- Alternatives:
- Alternatives:
struct Profile $.profile
- Alternatives:
What zigshape decides
- Smallest unsigned int width that fits every observed value (override with the Strict preset for
u64). - Optional fields when data is missing or
nullin any sample. std.StringHashMapwhen an object's keys look dynamic and values share a shape.std.json.Valuefallback for heterogeneous fields, with a warning explaining why.
For the serde.zig-decorated form (with rename_all, alias, deny_unknown_fields),
see JSON to serde.zig.