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 null in any sample.
  • std.StringHashMap when an object's keys look dynamic and values share a shape.
  • std.json.Value fallback 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.

Local-first. Your input never leaves the browser.