Zig structs from real-world data
Paste JSON, YAML, TOML, XML, CSV, ZON or TOON. zigshape infers types across every sample, explains each
decision, and emits structs for std.json or serde.zig.
API responseSmallest int widths from observed range; auto enum suggestion; missing/null become optional.
{
"userId": 1,
"firstName": "Alice",
"email": "alice@example.com",
"lastSeenAt": "2026-01-01T10:00:00Z"
}User.zig const serde = @import("serde");
pub const User = struct {
user_id: u8,
first_name: []const u8,
email: []const u8,
last_seen_at: []const u8,
pub const serde = .{
.rename_all = .camel_case,
};
};
Diagnostics
2 warningsField decisions
Why each field got its type. Click a row to see it in the input; edit to override.
struct User $ 4 fields
Inference across samples
Add several payloads of the same shape. Fields missing or null in any of them become optional, and integer widths fit the observed range.
Every decision explained
The field table shows how often each key appeared, which value kinds were seen, and where it sits in the input. Override any type in place.
Output that parses
Plain structs keep wire names for std.json; serde.zig structs get rename_all, aliases and tagged unions. Both read your samples back.
Converters
- JSON to Zig struct std.json
- JSON to serde.zig serde.zig
- YAML to Zig struct std.json
- YAML to serde.zig serde.zig
- TOML to Zig struct std.json
- TOML to serde.zig serde.zig
- XML to Zig struct serde.zig
- XML to serde.zig serde.zig
- CSV to Zig struct serde.zig
- ZON to Zig struct std.zon
- TOON to Zig struct serde.zig
- NDJSON to Zig struct std.json