📝 updated documentation for update() function #661

This commit is contained in:
Niels Lohmann 2017-08-15 21:42:50 +02:00
parent 039e2f03bc
commit 72afe53fa0
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69
8 changed files with 86 additions and 6 deletions

View file

@ -0,0 +1,17 @@
#include <iostream>
#include "json.hpp"
using json = nlohmann::json;
int main()
{
// create two JSON objects
json o1 = R"( {"color": "red", "price": 17.99} )"_json;
json o2 = R"( {"color": "blue", "speed": 100} )"_json;
// add all keys from o2 to o1 (updating "color")
o1.update(o2.begin(), o2.end());
// output updated object o1
std::cout << std::setw(2) << o1 << '\n';
}