diff --git a/README.md b/README.md index 2a9cdb1a..7147b44f 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,9 @@ You can create an object (deserialization) by appending `_json` to a string lite ```cpp // create object from string literal json j = "{ \"pi\": 3.141, \"happy\": true }"_json; + +// or even nicer (thanks http://isocpp.org/blog/2015/01/json-for-modern-cpp) +auto j2 = R"( {"pi": 3.141, "happy": true} )"_json; ``` You can also get a string representation (serialize): diff --git a/test/json_unit.cc b/test/json_unit.cc index c2cb0f3e..05ba4c5f 100644 --- a/test/json_unit.cc +++ b/test/json_unit.cc @@ -1775,6 +1775,10 @@ TEST_CASE("Parser") auto j3 = "{\"key\": \"value\"}"_json; CHECK(j3["key"] == "value"); + + auto j22 = R"({"pi": 3.141, "happy": true })"_json; + auto j23 = "{ \"pi\": 3.141, \"happy\": true }"_json; + CHECK(j22 == j23); } SECTION("Errors")