diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-01-17 12:30:34 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-01-17 12:55:26 +0900 |
| commit | 22811834abe3603e28128a17ac004b1aeea3d651 (patch) | |
| tree | 071fb87406565a5950f9936dab4d94bb68b14eb6 /src/jv | |
| parent | 11b20173316188f511f24dc4121412097da7848d (diff) | |
| download | zgjq-22811834abe3603e28128a17ac004b1aeea3d651.tar.gz zgjq-22811834abe3603e28128a17ac004b1aeea3d651.tar.zst zgjq-22811834abe3603e28128a17ac004b1aeea3d651.zip | |
implement identity filter
Diffstat (limited to 'src/jv')
| -rw-r--r-- | src/jv/parse.zig | 6 | ||||
| -rw-r--r-- | src/jv/stringify.zig | 6 | ||||
| -rw-r--r-- | src/jv/value.zig | 3 |
3 files changed, 15 insertions, 0 deletions
diff --git a/src/jv/parse.zig b/src/jv/parse.zig new file mode 100644 index 0000000..c1d35fc --- /dev/null +++ b/src/jv/parse.zig @@ -0,0 +1,6 @@ +const std = @import("std"); +const Value = @import("./value.zig").Value; + +pub fn parse(allocator: std.mem.Allocator, input: []const u8) !std.json.Parsed(Value) { + return try std.json.parseFromSlice(Value, allocator, input, .{}); +} diff --git a/src/jv/stringify.zig b/src/jv/stringify.zig new file mode 100644 index 0000000..341fed3 --- /dev/null +++ b/src/jv/stringify.zig @@ -0,0 +1,6 @@ +const std = @import("std"); +const Value = @import("./value.zig").Value; + +pub fn stringify(allocator: std.mem.Allocator, value: Value) ![]u8 { + return try std.json.Stringify.valueAlloc(allocator, value, .{}); +} diff --git a/src/jv/value.zig b/src/jv/value.zig new file mode 100644 index 0000000..075d5fe --- /dev/null +++ b/src/jv/value.zig @@ -0,0 +1,3 @@ +const std = @import("std"); + +pub const Value = std.json.Value; |
