Boost logo

Boost :

Subject: [boost] Interest in a Boost.JSON library?
From: Kirit Sælensminde (kirit.saelensminde_at_[hidden])
Date: 2008-12-21 02:51:37


As part of our web application framework (currently being ported from
Windows to Linux) we have a JSON parser and library that might be of
interest to a wider community as part of the Boost libraries.

It uses a Spirit parser that deals correctly with embedded UTF-16 inside
strings. The JSON blobs themselves are built on Boost.Variant and can
store null, booleans, strings, int64_t, doubles and arrays & objects.

The strings are our Unicode string implementation -- how this should be
dealt with in Boost is an open question maybe only cleanly soluble when
Boost has it's own proper Unicode string handling. A templated adapter
layer could be used I think for both the string and the numeric types.

There is also the internal implementation of the array and objects which
could be moved to a policy based design. At the moment we use
std::vector and std::map with boost::shared_ptr< json > as the value
type. The JSON objects are immutable and use a thread safe CoW
implementation when changes are required (handled through a separate
jcursor object).

One thing that is missing is a good EDSL for creating JSON blobs within
C++ source code.

The latest implementations is where we are using it to create an ACID
JSON database and is here:
http://svn.felspar.com/public/fost-base/branches/dbschema/Cpp/include/fost/json.hpp

The parser itself is here:
http://svn.felspar.com/public/fost-base/branches/dbschema/Cpp/include/fost/json/parse.hpp

There's a lot of room for improvement, but hopefully it's a good start.

K


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk