GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Categories
  • Newsletter
  • Submit
  • Login
  • Awesome C++
  • JSON

This view

  • Original page
  • New address

GeezerVison is showing cpp.libhunt.com — JeayeSON Alternatives - C++ JSON | LibHunt

  • Subscribe
  • Submit
  • Categories
  • About
  • Login

JeayeSON

A very sane (header only) C++14 JSON library

jeaye logo
Source Code    Changelog
Suggest Changes
Take the C++ Developer Survey - About 6 minutes on the tools, libraries and AI you use with C++. You get the results by email. Take the survey »
Popularity
2.8
Stable
Activity
0.0
Stable
Stars 136
Watchers 12
Forks 23
Last Commit almost 10 years ago

Code Quality Rank: L2
Programming language: C++
License: BSD 3-clause "New" or "Revised" License
Tags: JSON    

JeayeSON alternatives and similar libraries

Based on the "JSON" category.
Alternatively, view JeayeSON alternatives based on common mentions on social networks and blogs.

  • json

    9.9 9.8 L1 JeayeSON VS json
    JSON for Modern C++
    nlohmann logo
  • RapidJSON

    9.5 0.0 L1 JeayeSON VS RapidJSON
    A fast JSON parser/generator for C++ with both SAX/DOM style API
    Tencent logo
  • SaaSHub - Software Alternatives and Reviews

    SaaSHub helps you find the best software and product alternatives
    Promo www.saashub.com
    SaaSHub Logo
  • simdjson

    9.5 9.5 JeayeSON VS simdjson
    Parsing gigabytes of JSON per second : used by Facebook/Meta Velox, the Node.js runtime, ClickHouse, WatermelonDB, Apache Doris, Milvus, StarRocks
    simdjson logo
  • cJSON

    9.4 3.9 L3 JeayeSON VS cJSON
    Ultralightweight JSON parser in ANSI C
    DaveGamble logo
  • JsonCpp

    9.1 7.8 L1 JeayeSON VS JsonCpp
    A C++ library for interacting with JSON.
    open-source-parsers logo
  • yaml-cpp

    8.7 8.1 JeayeSON VS yaml-cpp
    A YAML parser and emitter in C++
    jbeder logo
  • ArduinoJson

    8.6 5.1 JeayeSON VS ArduinoJson
    📟 JSON library for Arduino and embedded C++. Simple and efficient.
    bblanchon logo
  • JSMN

    7.8 0.0 L3 JeayeSON VS JSMN
    Jsmn is a world fastest JSON parser/tokenizer. This is the official repo replacing the old one at Bitbucket
    zserge logo
  • json-c

    7.8 8.7 JeayeSON VS json-c
    https://github.com/json-c/json-c is the official code repository for json-c. See the wiki for release tarballs for download. API docs at http://json-c.github.io/json-c/
    json-c logo
  • Jansson

    7.7 7.2 L2 JeayeSON VS Jansson
    C library for encoding, decoding and manipulating JSON data
    akheron logo
  • json11

    7.5 0.6 L2 JeayeSON VS json11
    DISCONTINUED. A tiny JSON library for C++11. [MIT]
  • YAJL

    7.0 0.0 L3 JeayeSON VS YAJL
    A fast streaming JSON parsing library in C.
    lloyd logo
  • LIBUCL

    6.2 8.1 L2 JeayeSON VS LIBUCL
    Universal configuration library parser
    vstakhov logo
  • json-parser

    6.0 5.3 L1 JeayeSON VS json-parser
    Very low footprint DOM-style JSON parser written in portable ANSI C
    json-parser logo
  • PicoJSON

    5.8 0.0 L1 JeayeSON VS PicoJSON
    a header-file-only, JSON parser serializer in C++
    kazuho logo
  • frozen

    5.1 2.6 L1 JeayeSON VS frozen
    JSON parser and generator for C/C++ with scanf/printf like interface. Targeting embedded systems.
    cesanta logo
  • json.h

    4.8 7.8 JeayeSON VS json.h
    🗄️ single header json parser for C and C++
    sheredom logo
  • JSON++

    4.7 0.0 L1 JeayeSON VS JSON++
    DISCONTINUED. A JSON parser in C++
  • QJson

    3.9 1.9 L1 JeayeSON VS QJson
    DISCONTINUED. QJson is a qt-based library that maps JSON data to QVariant objects.
    flavio logo
  • qt-json

    3.8 0.0 L3 JeayeSON VS qt-json
    DISCONTINUED. A simple class for parsing JSON data into a QVariant hierarchy and vice versa.
    qt-json logo
  • libjson

    3.8 1.4 L3 JeayeSON VS libjson
    a JSON parser and printer library in C. easy to integrate with any model.
    vincenthz logo
  • Boost.PropertyTree

    3.1 0.7 L1 JeayeSON VS Boost.PropertyTree
    Boost.org property_tree module
    boostorg logo
  • json_dto

    2.9 7.4 JeayeSON VS json_dto
    A small header-only library for converting data between json representation and c++ structs
    Stiffstream logo
  • json-voorhees

    2.7 9.3 L3 JeayeSON VS json-voorhees
    A killer modern C++ library for interacting with JSON.
    tgockel logo
  • StructMapping

    2.6 0.0 JeayeSON VS StructMapping
    Mapping json to and from a c++ structure
    bk192077 logo
  • Jsonifier

    2.4 4.7 JeayeSON VS Jsonifier
    A few classes for extremely fast json parsing/serializing in modern C++. Possibly the fastest json parser in C++. Possibly the fastest json serializer in C++.
    nihilai-collective logo
  • jute

    2.4 2.2 L3 JeayeSON VS jute
    Very simple C++ JSON Parser
    amir-s logo
  • ujson

    2.3 - JeayeSON VS ujson
    µjson is a a small, C++11, UTF-8, JSON library. [MIT]
  • iod.metajson

    2.0 0.0 JeayeSON VS iod.metajson
    Non-intrusive, high performance C++17 lightweight JSON de/serializer
    iodcpp logo
  • jvar

    1.8 0.0 JeayeSON VS jvar
    JS inspired Variants and JSON parsing for C++
    YasserAsmi logo
  • jbson

    1.8 0.0 L1 JeayeSON VS jbson
    JSON & BSON parser/writer
    chrismanning logo

* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.

Do you think we are missing an alternative of JeayeSON or a related project?

Add another 'JSON' Library

Popular Comparisons

  • JeayeSON
    vs
    json
  • JeayeSON
    vs
    ujson
  • JeayeSON
    vs
    RapidJSON
  • JeayeSON
    vs
    JsonCpp
  • JeayeSON
    vs
    cJSON

README

JeayeSON - a very sane C++14 JSON library Build Status

JeayeSON was designed out of frustration that there aren't many template-based approaches to handling JSON in modern C++. Given a very limited number of types (that JSON offers), functions can be written in a generic manner to provide the most consistent interface, no matter the type. JeayeSON is a non-validating JSON library; it expects valid JSON all of the time.

  • Header only (easy to add to any project)
  • Small, consistent C++ API
  • Typesafe, C++14 interface
  • Absolutely no macros needed nor used
  • UTF-8 (with UTF-16 transcoding)
  • Extensive test suite (using jest, a "sane and minimal C++14 unit test framework")

Practice

Assuming the JeayeSON headers are in your search path, simply

#include <jeayeson/jeayeson.hpp>

NOTE: If you're on Windows and symbolic links don't work, use

#include <jeayeson/value.hpp>

This will give you access to the following types:

json_value    /* variant type */
json_map      /* string->json_value map */
json_array    /* contiguous array of json_values */
json_null     /* json_value's default state */
json_int      /* defaults to int64_t */
json_float    /* defaults to double */
json_file     /* aggregate type representing a filename */
json_data     /* aggregate type representing json data as a string */

Building JSON

Assume we want to create this JSON:

{
  "hello": "world",
  "arr":
  [ 1.1, 2.2, 3.3 ],
  "person":
  {
    "name": "Tom",
    "age": 36,
    "weapon": null
  }
}

We can simply do:

json_value val // json_value can be any json type; here, it's a json_map
{
  { "hello", "world" }, // nested pairs represent key/value
  {
    "arr",
    { 1.1, 2.2, 3.3 } // arrays are easy
  },
  {
    "person",
    {
      { "name", "Tom" },
      { "age", 36 },
      { "weapon", nullptr } // can also use json_null
    }
  }
};

Or, if we wanted to build it piece by piece:

json_map val; // explicitly make a map this time

val["hello"] = "world"; // simple assignments work on all compatible types

val["arr"] = { 1.1, 2.2, 3.3 }; // implicit array construction

json_map person; // we'll build the person separately, too
person["name"] = "Tom";
person["age"] = 36;
person["weapon"] = nullptr;

val["person"] = person; // now we can just put the person map into val

// we can even dig into nested maps and arrays using op[]
val["person"]["name"] = "Susan";

Reading a JSON string

std::string json; // Acquired/initialized elsewhere
json_array arr{ json_data{ json } }; // simple aggregate for type-safety

Reading a file

json_map map{ json_file{ "my_file.json" } }; // simple aggregate for type-safety

Writing JSON

// maps, arrays, and values can all be used with streams
json_map map{ json_file{ "my_file.json" } };
std::cout << map << std::endl;

// you can also just write them to a string
std::string const json{ map.to_string() };

Feels like the C++ stdlib

You'll find all the normal stdlib-like functions, including iterator support.

json_array json;
json.push_back("string");
json.push_back(3.14159);
json.push_back(false);

for(auto const &j : json) // has begin, end, cbegin, cend, etc
{ std::cout << j << std::endl; }

// works like an std::vector or std::map
json.size();
json.empty();
json.clear();
json.reserve(42);

Type checking and casting

json_map json
{
  { "boolean", false },
  { "str", "..." }
};

// check types with is<T>()
json["boolean"].is<json_value::type::boolean>(); // true
json["str"].is<json_value::type::string>(); // true

// query the type enum
auto const type(json["str"].get_type());

// cast with as<T>() to get the complete type
auto const str(json["str"].as<json_string>());

Installation

The ./configure script must be used at least once to automagically generate jeayeson/config.hpp (see Customization). Since JeayeSON is a header-only library, simply copy over the contents of include to your project, or, better yet, add JeayeSON as a submodule and introduce jeayeson/include to your header search paths

A full installation can also be achieved by using ./configure && make install. See the ./configure script for prefix options.

Dependencies

  • A C++14 compiler (GCC 5.x or Clang 3.8+ recommended)
  • Boost (1.55.0+ recommended)

Customization

NOTE: All configuration is easily done in jeayeson/config.hpp, which is generated when you run ./configure (and is not overwritten subsequently -- delete it to reset).

Customization can be achieved by adjusting the types in the jeayeson::config struct template. A specialization is already provided, which contains the default types used by JeayeSON. Feel free to change the types to any other, still compatible, types.

For example, you may want the json integer type to be 32bit instead of the default 64bit. Or, you may want to use std::unordered_map instead of std::map.

Building tests

NOTE: You don't actually have to build JeayeSON, since it's a header-only library. This build process is only for the tests.

In the project directory, run:

$ ./configure && make

# Depending on your compiler setup (gcc or clang, linux or osx, etc)
# you may need to specify some extra flags. An example case:
# (allows clang & libc++ to work on Arch Linux)
$ CXX=clang++ CXX_FLAGS=-stdlib=libc++ LD_LIBS=-lc++abi make

Once built, you can run the tests:

$ make test

The tests (in test/src and test/include) can give more examples on how to use JeayeSON.

Do not miss the trending, libraries, news and articles with our weekly report.

Awesome C++ is part of the LibHunt network. Terms. Privacy Policy.

(CC)
BY-SA
Spin The Wheel Of Names for a cryptographically secure random name picker.
Schedule a when to meet poll.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.