Last active
March 1, 2017 21:52
-
-
Save nlohmann/924dab4b3a4d02d02190c49339258d4e to your computer and use it in GitHub Desktop.
Mail for the std-proposals forum
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hi there, | |
I am wondering whether JSON [RFC7159] support would be a helpful extension to the C++ standard library (pure library extension), including, but not limited to, the following aspects: | |
1. A variant-like container type (for this mail, let's call it "std::json") that combines C++ types for the JSON value types [RFC7159, chapter 3]: | |
- string (e.g. std::string), | |
- number (e.g., double or int64_t), | |
- boolean (e.g., bool), | |
- array (e.g., std::vector), and | |
- object (e.g., std::map). | |
This type should have an intuitive API (i.e., all expected container methods), but also use as much syntactic sugar as possible (e.g., using initializer lists to express arrays like "std::json my_array = {"a string", 17, 42.12};". | |
2. A serialization function to create a textual representation (called "JSON text" in [RFC7159]) from a std::json value that conforms to the JSON grammar [RFC7159, chapter 2-7]. | |
3. A deserialization function (i.e., a parser) [RFC7159, chapter 9] to create a std::json value from a JSON text. | |
There are currently dozens of libraries [json.org] written in C or C++ solving these aspects. However, it would be of great convenience to have JSON be part of the C++ standard library. In particular, the wide use of JSON as exchange format for structured data as well as to express simple configuration data would could solve a lot of use cases within the C++ standard library. | |
I would be willing to draft a proposal based on the experience I made with my C++ JSON library [nlohmann/json]. Of course, I would be interested in your thoughts on this. | |
All the best, | |
Niels | |
References | |
[RFC7159] https://tools.ietf.org/html/rfc7159.html | |
[json.org] http://json.org | |
[nlohmann/json] https://github.com/nlohmann/json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great!
JSONPath (http://jsonpath.com), yes this was it. I remember people asking for this on reddit.