Tuesday, March 4, 2014

The experiment: a C++11 JSON library

Introducing the json experiment, a new library that I'm building to create, manipulate, and parse JSON in C++11.



For example, objects can be created by using an initializer_list:

    jsonex::object json{
        {"A", {{"A1", 1}, {"A2", 2} }},
        {"B", {{"B1", 1}, {"B2", 2} }},
        {"C", {{"C1", {{"C11", 11}, {"C12", 12} }}, {"C2", 2} }},
    }; 

If that's not cool enough, how about using an initializer list with a vector of objects?

    std::vector json_vector{1, 2, 3, "A", false, nullptr}; 
 
I'm about 3 days into this project, but the code above is taken directly from some of the unit tests, so I'm a bit encouraged that this may turn out to be something useful. I hope to get it up on bitbucket pretty soon.

More to come.

No comments: