json-c ported to the zig build system
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-05-30 23:02:28 +02:00
.github/workflows Update for Zig 0.16 2026-05-30 23:02:28 +02:00
.gitignore Update for Zig 0.16 2026-05-30 23:02:28 +02:00
build.zig Update for Zig 0.16 2026-05-30 23:02:28 +02:00
build.zig.zon Update for Zig 0.16 2026-05-30 23:02:28 +02:00
LICENSE Create LICENSE 2024-09-12 19:49:07 +02:00
README.md Update for Zig 0.16 2026-05-30 23:02:28 +02:00

build.zig for json-c

Provides a package to be used by the zig package manager for C programs.

Status

For now the hard-coded config assumes linux.

Refname json-c version Zig 0.16.x Zig 0.15.x Zig 0.14.x Zig 0.13.x Zig 0.12.x
0.18+3 json-c-0.18-20240915 ✅ ✅ ❌ ❌ ❌
0.18+2 json-c-0.18-20240915 ❌ ✅ ✅ ❌ ❌
0.18 json-c-0.18-20240915 ❌ ❌ ❌ ✅ ✅
0.17 json-c-0.17-20230812 ❌ ❌ ❌ ✅ ✅

Use

Add the dependency in your build.zig.zon by running the following command:

zig fetch --save git+https://github.com/allyourcodebase/json-c#master

Then, in your build.zig:

const jsonc = b.dependency("jsonc", { .target = target, .optimize = optimize });
const libjsonc = jsonc.artifact("json-c");
// wherever needed:
exe.linkLibrary(libjsonc);