| ... | ... | @@ -765,3 +765,11 @@ pub fn stringify(writer: anytype, value: anytype, options: std.json.StringifyOpt |
| 765 | 765 | else => @compileError(@typeName(T)), |
| 766 | 766 | } |
| 767 | 767 | } |
| 768 | |
| 769 | pub fn stringifyAlloc(allocator: std.mem.Allocator, value: anytype, options: std.json.StringifyOptions) ![]u8 { |
| 770 | var writer: nio.AllocatingWriter = .init(allocator); |
| 771 | defer writer.deinit(); |
| 772 | try writer.ensureUnusedCapacity(256); |
| 773 | try stringify(&writer, value, options); |
| 774 | return writer.toOwnedSlice(); |
| 775 | } |