Jansson 2.4 has been released. This release adds new features and fixes a few bugs and documentation issues. It also adds support for building the library on Microsoft Visual Studio. The full release notes are available here.
A new macro, json_boolean(), was added. It returns either the JSON true or JSON false value based on its argument. It's useful in situations like this:
json_t *value; int yes = read_value_from_somewhere(); value = json_boolean(yes); /* false if yes == 0, true otherwise */
It's now possible to decode JSON with a callback providing the source JSON text. The new json_load_callback() function calls a callback repeatedly to read the source JSON. This is useful when the JSON data is received from a custom stream, for example.
JSON allows, but doesn't require, escaping
\/. This is useful when JSON is embedded in a
<script> tag, because the
</ must not occur inside
<script> tag. When using the
JSON_ESCAPE_SLASH encoding flag, Jansson now
/'s for you.
Until now, it has been possible to make Jansson produce invalid JSON
by creating a real value with an Inf or NaN special
now check for these special values and refuse to accept them,
returning -1 to signal an error. (As a matter of
json_real_set() returned 0 even on other errors,
and this was fixed, too.)
It's now possible to build Jansson on Windows with Microsoft Visual
Studio. All the build errors have been fixed, and solution and
project files for Visual Studio 2010 are included in
win32/vs2010/ directory in the source distribution.