1
0
Fork 0
mirror of https://github.com/zigzap/zap.git synced 2025-10-20 15:14:08 +00:00

fix hello_json

This commit is contained in:
renerocksai 2025-08-28 20:29:11 +02:00
parent 5740b3b1a1
commit 23162dbe2e
No known key found for this signature in database

View file

@ -75,12 +75,11 @@ pub fn toCharPtr(s: []const u8) [*c]u8 {
pub fn stringifyBuf( pub fn stringifyBuf(
buffer: []u8, buffer: []u8,
value: anytype, value: anytype,
options: std.json.StringifyOptions, options: std.json.Stringify.Options,
) ![]const u8 { ) ![]const u8 {
var fba = std.heap.FixedBufferAllocator.init(buffer); var w: std.io.Writer = .fixed(buffer);
var string = std.ArrayList(u8).init(fba.allocator()); if (std.json.Stringify.value(value, options, &w)) {
if (std.json.stringify(value, options, string.writer())) { return w.buffered();
return string.items;
} else |err| { // error } else |err| { // error
return err; return err;
} }