Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Comparison to Other Libraries

There exist many C++ JSON libraries, but two are particularly noteworthy for the purpose of comparison: RapidJSON and JSON for Modern C++ (referred to herein as nlohmann's JSON, or nlohmann).

Comparison to nlohmann JSON

template<
    template<typename, typename, typename...> class ObjectType,
    template<typename, typename...> class ArrayType,
    class StringType,
    class BooleanType,
    class NumberIntegerType,
    class NumberUnsignedType,
    class NumberFloatType,
    template<typename> class AllocatorType,
    template<typename, typename = void> class JSONSerializer
    >
class basic_json
{
  private:
    ....
    friend ::nlohmann::detail::parser<basic_json>;
    friend ::nlohmann::detail::serializer<basic_json>;
...

This library adopts a "kitchen sink" approach. It contains a wealth of features, even those with niche uses. Its weakness is that the many template parameters, while allowing for configurability, inhibit the best possible optimizations. The consequence is that the library performs poorly. The ability to configure every aspect of the value type has the paradoxical effect of making it less suitable as a vocabulary type.

Comparison to RapidJSON

template <typename Encoding, typename Allocator = MemoryPoolAllocator<> >
class GenericValue;

template <bool Const, typename ValueT>
class GenericArray;

template <bool Const, typename ValueT>
class GenericObject;

Comparison to SIMD JSON

https://github.com/lemire/simdjson

class ParsedJson;

This is quite an interesting data structure, which is optimized to work well with the SIMD parser. It makes very good design choices for the intended use-case. However it is not well suited as a vocabulary type due to the necessary limitations.


PrevUpHomeNext