fn stringify(value: anytype, options: StringifyOptions, out_stream: anytype) @TypeOf(out_stream).Error!void

Writes the given value to the std.io.Writer stream. See WriteStream for how the given value is serialized into JSON. The maximum nesting depth of the output JSON document is 256. See also stringifyMaxDepth and stringifyArbitraryDepth.

Parameters

value: anytype,
out_stream: anytype,

DocTests

test stringify {
    var out = ArrayList(u8).init(testing.allocator);
    defer out.deinit();

    const T = struct { a: i32, b: []const u8 };
    try stringify(T{ .a = 123, .b = "xy" }, .{}, out.writer());
    try testing.expectEqualSlices(u8, "{\"a\":123,\"b\":\"xy\"}", out.items);
}