This page is experimental and subject to change without notice. The software patch here is not yet officially blessed by Jansson.

Discussion is welcome—please use the Jansson mailing list rather than contacting me directly.

Also see demjson, my Python language implementation of JSON which supports arbitrary precision numbers, both integer and floating-point. It also provides a jsonlint tool that can check your JSON documents for portability issues, such as numeric overflow.

This page describes an experimental set of patches to the open source Jansson C library for manipulating JSON formatted data that may contain numbers that are larger or beyond the precision that can be represented by the supported C number types. The patches enable a set of hooks in Jansson that allow the user to plug in an external big number software package.

All my patches are released under the same Open Source licencing terms used by Jansson. See COPYING

Tested big number packages

This patch should be able to accomodate nearly any big number package. The following big number packages have been tested with this patch:

Integer Real Package Description
- Y long double Standard C 'long double' type
- Y quadmath GNU quadmath library, integrated into newer versions of GCC
Y Y gmp GNU multiple precision arithmetic library
Y - openssl OpenSSL BIGNUM library

The patch

November 4, 2011: Download the patch against Jansson 2.2.1:

View the patched documentation. In particular see the section Big Number Extension, and also the RFC conformance and API Reference sections.

List of files changed or added:

doc/apiref.rst
doc/conformance.rst
samples/json_bignum_gmp.c
samples/json_bignum_ldbl.c
samples/json_bignum_openssl.c
samples/json_bignum_quad.c
src/dump.c
src/jansson.h
src/jansson_private.h
src/load.c
src/memory.c
src/pack_unpack.c
src/strconv.c
src/value.c