Getty JSON is a (de)serialization library for the JSON data format.
Declare Getty JSON as a project dependency with
zig fetch:zig fetch --save git+https://github.com/getty-zig/json.git#<COMMIT>
Expose Getty JSON as a module in your project's
build.zig:pubfnbuild(b: *std.Build) void { consttarget=b.standardTargetOptions(.{}); constoptimize=b.standardOptimizeOption(.{}); constopts= .{ .target=target, .optimize=optimize }; // 👈constjson_mod=b.dependency("json", opts).module("json"); // 👈constexe=b.addExecutable(.{ .name="my-project", .root_source_file= .{ .path="src/main.zig" }, .target=target, .optimize=optimize, }); exe.root_module.addImport("json", json_mod); // 👈// ... }
Import Getty JSON into your code:
constjson=@import("json");