Repository navigation
This is a full rewrite. The library is now a single header — drop json.h into your project, include it, and you're done. json.c is gone.
Breaking change: V3 shares no API surface with V2. See MIGRATION.md for a full mapping.
What's new
Arena ownership. Everything the parser allocates lives in a single arena attached to json_root. One json_free(&root) releases the entire tree. No per-node cleanup, no leak risk.
Path expressions. Read nested values without walking the tree:
json_path_get_long(&root.value, "hits[0].score", &n);Byte-accurate errors. Every failure returns both a json_status and a zero-based byte offset pointing at the exact problem in the input.
Honest numbers. Source text is always preserved. as_double is always set. as_long and is_long are only set when the value is an integer that fits exactly in long — overflow is not an error.
Validate-only mode. Pass NULL for out to check syntax without building a DOM.
Custom allocators. Supply your own malloc/realloc/free via json_config.
Fixes
Closes #22, #23, #25, #26, #27, #28 — including four security issues (heap buffer overflows, segfault, type confusion) that affected V2's json.c, which no longer exists.
Verified
-std=c89 -pedantic -Wall -Wextra -Werror
-std=c89 ... -fsanitize=address,undefined
-std=c99 / -std=c11