Changelog
JsonLib - 1.1.0 - 2026-07-12
Added
Makefilewrapping the CMake build.make buildcompiles everything,make testruns the unit tests, andmake help(the default target) lists the rest.- Regression tests for all of the fixes below (
ZeroAndNegativeFloats,SurrogatePairs, andLargeKeyAndDeepNesting). ctestintegration. The test executable is registered withadd_test, andmake ctestruns it portably.- Documentation built with
wj-mkdocs.make docsproduces a self-contained HTML site inhtml/, andmake publish-docspublishes it to the WaterJuice docs site viawj-publish.
Fixed
- Heap buffer overflow when writing a dictionary key larger than the output buffer's grow block (~32 KB). The buffer now grows by whole blocks until the data fits.
- Test harness (WjTestLib) always exited with a success code even when tests failed, because
the per-test result was discarded in the run loop. A failing assert now produces a non-zero
exit code, so
make test,make ctest, and CI can actually gate on it. A memory leak in a test now also fails the run, matching how the printed summary already reported it. - Test helper
FloatsAreEqualdivided by the expected value, giving a divide-by-zero (NaN, wrongly reported as unequal) when comparing against zero. It now compares relative to the larger magnitude. - Missing nesting-depth bound on the output side: serializing an object tree nested deeper
than
MAX_JSON_DEPTHoverran the fixed process stack. It now returnsJL_STATUS_JSON_NESTING_TOO_DEEP, matching the parser. - Unmarshalling a number into a
floatfield rejected zero, negatives, and subnormals because the lower bound wasFLT_MIN(smallest positive normal) instead of-FLT_MAX. - Zero-valued float literals (
0.0,-0.0) were rejected as invalid data during parsing. - Surrogate-pair decoding validated the wrong half, accepting an invalid low surrogate (>= 0xE000) instead of rejecting it.
- Unchecked size multiplication when allocating an unmarshalled array could overflow
size_ton 32-bit platforms; oversized lists now returnJL_STATUS_TOO_MANY_ITEMS.
Removed
Source/DataModel.c, a stale pre-rename copy ofJlDataModel.c. It was not part of the build and could not compile, as the headers it included no longer exist.
JsonLib - 1.0.0 - 2019-11-24
Initial release.
Added
- Marshalling of C structures to JSON, and unmarshalling of JSON back into C structures,
driven by a declarative
JlMarshallElementmapping table built with theJlMarshall*macros. - Parsing of both JSON5 and strict JSON. JSON5 is accepted by default; strict mode is
available via the
Exfunctions. - Output of both JSON and JSON5, with flags for indenting, ASCII escaping, bare keywords, single quotes, trailing commas, and hex numbers.
- Supported field mappings: strings, structs, unsigned and signed integers (8/16/32/64 bit), hex formatted unsigned integers, floats and doubles, bools, and Base64 encoded binary blobs. Each is available as a single value, an allocated array, and a fixed size array.
JsonLibTestsunit test suite, built on the bundledWjTestLibtest framework with allocation tracking for leak detection.JsonRewritecommand line tool for reading a JSON file and writing it back out in a chosen format.JsonLibSampleminimal example program.