Start implementing ZIG

This commit is contained in:
Fabian Stamm
2022-07-16 21:03:27 +00:00
parent af4902c9a8
commit 8ee16fb09d
9 changed files with 204 additions and 9 deletions

20
examples/Zig/src/main.zig Normal file
View File

@ -0,0 +1,20 @@
const std = @import("std");
const t = @import("./generated/mod.zig");
var mygpa = std.heap.GeneralPurposeAllocator(.{}){};
const gpa = mygpa.allocator();
const payload =
\\{
\\ "val_number": 0.12,
\\ "val_boolean": true,
\\ "val_string": "Hallo Welt"
\\}
;
pub fn main() !void {
var stream = std.json.TokenStream.init(payload);
const res = std.json.parse(t.TestAtom, &stream, .{ .allocator = gpa }) catch unreachable;
std.log.info("{} {s}", .{ res, res.val_string });
}