authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-05-31 01:21:51 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-05-31 01:21:51 -07:00
logdede9ed9acffe9cd08a12b51a68b566120d7004d
tree1bc3f37ea23a0a8d208e9615c76b056f937e6994
parent7a54d3cbd80ebdf78d6d7b16c86dfa81af42d1a4

add parse_json


1 files changed, 5 insertions(+), 0 deletions(-)

src/lib.zig+5
...@@ -497,3 +497,8 @@ pub fn assertLog(ok: bool, message: string) void {...@@ -497,3 +497,8 @@ pub fn assertLog(ok: bool, message: string) void {
497 if (!ok) std.log.err("assertion failure: {s}", .{message});497 if (!ok) std.log.err("assertion failure: {s}", .{message});
498 if (!ok) unreachable; // assertion failure498 if (!ok) unreachable; // assertion failure
499}499}
500
501pub fn parse_json(alloc: std.mem.Allocator, input: string) !std.json.ValueTree {
502 var p = std.json.Parser.init(alloc, .alloc_always);
503 return try p.parse(input);
504}