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.

Target

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"
}
JSON 95% sure 6 lines 113 B Drop files here to add samples
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,
    };
};
loading zig fmt 1 struct · 4 fields 12 lines

Diagnostics

2 warnings

Field 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