Zig 0.17.0-dev (Split by item) This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig standard library.
std › json › dynamic › Value › jsonStringify Public Function jsonStringify Doc Source Public Function std.json.dynamic.Value.jsonStringify
pub fn jsonStringify (value : @This (), jws : anytype ) !void Params File json/dynamic.zig: 55
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74 pub fn jsonStringify (value : @This (), jws : anytype ) !void {
switch (value ) {
.null => try jws .write (null ),
.bool => |inner | try jws .write (inner ),
.integer => |inner | try jws .write (inner ),
.float => |inner | try jws .write (inner ),
.number_string => |inner | try jws .print ("{s}" , .{inner }),
.string => |inner | try jws .write (inner ),
.array => |inner | try jws .write (inner .items ),
.object => |inner | {
try jws .beginObject ();
var it = inner .iterator ();
while (it .next ()) |entry | {
try jws .objectField (entry .key_ptr .*);
try jws .write (entry .value_ptr .*);
}
try jws .endObject ();
},
}
}