Streaming JSON writer. Part of libsig core: installed with the
headers and public API (used by sig_mgmt and available to other
modules). Commas and colons are inserted
automatically. Any allocation failure or nesting-depth overflow is
sticky: later writes are ignored and sig_json_finish() reports
SIG_ERR_ALLOC. Doubles are formatted with the C locale's decimal
point (libsig never calls setlocale).
On SIG_OK, *out is a NUL-terminated heap string the caller must
sig_free(), *out_len excludes the NUL, and j is left empty and
reusable. On SIG_ERR_ALLOC, *out is untouched and j is freed.