#Debugging JSON Parse errors in zig.

1 messages · Page 1 of 1 (latest)

silk vine
#

you can pass options to parseFromSlice in .{} at the end. One of them allows it to ignore unknown fields

#
    const Child = struct { model: []u8 };
    const T = struct { d: []Child };
    const parsed = try json.parseFromSlice(T, allocator, p_resp, .{.ignore_unknown_fields=true}); // <- change here
    defer parsed.deinit();