xonecas.io
79113
Ma

mini-coding-agent / files

mini-coding-agent / src / json.zig

466 bytes
1const std = @import("std");
2
3pub const Raw = struct {
4    bytes: []const u8 = "",
5
6    pub fn jsonStringify(self: Raw, jws: anytype) !void {
7        try jws.beginWriteRaw();
8        try jws.writer.writeAll(self.bytes);
9        jws.endWriteRaw();
10    }
11};
12
13pub fn stringField(obj: std.json.ObjectMap, key: []const u8) ?[]const u8 {
14    const value = obj.get(key) orelse return null;
15    return if (value == .string and value.string.len > 0) value.string else null;
16}