Jansson 2.1 released
By Petri Lehtinen on 2011-06-11
Jansson 2.1 was released yesterday. This release adds a few new features and fixes some minor bugs. The full release notes are available here.
New features
A new decoding
function, json_loadb()
,
was added for decoding buffers with length. The most important thing
is that the input buffer need not be null terminated. In the future,
it may also help to implement the support for zero bytes inside
strings.
json_loadb()
is
like json_loads()
,
except that it takes an additional length argument:
value = json_loadb(buffer, length, 0, &error);
This version also introduces two new decoding flags and one new encoding flag:
-
JSON_REJECT_DUPLICATES
: Issue a decoding error if any JSON object in the input contins duplicate keys. -
JSON_DISABLE_EOF_CHECK
: Stop decoding after a valid JSON input. This allows other data after the JSON data. -
JSON_ENCODE_ANY
: Allow encoding any JSON value. Without this flag, only arrays and objects can be encoded as the root value.
Bugfixes
- Fix a memory leak when memory allocation fails in json_object_set() and friends.
-
Clear
errno
before callingstrtod()
for better portability (MINGW in this case). - Avoid set-but-not-used warning/error when building with the newest GCC.
Tags:
jansson
announcement