aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/jv
diff options
context:
space:
mode:
Diffstat (limited to 'src/jv')
-rw-r--r--src/jv/parse.zig6
-rw-r--r--src/jv/stringify.zig6
-rw-r--r--src/jv/value.zig3
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;