Merge branch 'develop' into feature/issue269

# Conflicts:
#	README.md
This commit is contained in:
Niels 2016-06-23 00:04:55 +02:00
commit 7cff6c8771
3 changed files with 145 additions and 49 deletions

View file

@ -10371,7 +10371,7 @@ TEST_CASE("README", "[hide]")
// create object from string literal
json j = "{ \"happy\": true, \"pi\": 3.141 }"_json;
// or even nicer (thanks http://isocpp.org/blog/2015/01/json-for-modern-cpp)
// or even nicer with a raw string literal
auto j2 = R"(
{
"happy": true,
@ -10499,7 +10499,7 @@ TEST_CASE("README", "[hide]")
}
{
/// strings
// strings
std::string s1 = "Hello, world!";
json js = s1;
std::string s2 = js;
@ -10522,6 +10522,40 @@ TEST_CASE("README", "[hide]")
// etc.
}
{
// a JSON value
json j_original = R"({
"baz": ["one", "two", "three"],
"foo": "bar"
})"_json;
// access members with a JSON pointer (RFC 6901)
j_original["/baz/2"_json_pointer];
// "two"
// a JSON patch (RFC 6902)
json j_patch = R"([
{ "op": "replace", "path": "/baz", "value": "boo" },
{ "op": "add", "path": "/hello", "value": ["world"] },
{ "op": "remove", "path": "/foo"}
])"_json;
// apply the patch
json j_result = j_original.patch(j_patch);
// {
// "baz": "boo",
// "hello": ["world"]
// }
// calculate a JSON patch from two JSON values
json::diff(j_result, j_original);
// [
// { "op":" replace", "path": "/baz", "value": ["one", "two", "three"] },
// { "op":"remove","path":"/hello" },
// { "op":"add","path":"/foo","value":"bar" }
// ]
}
}
TEST_CASE("algorithms")