| 370 | } |
| 371 | |
| 372 | void json_replace_example3() |
| 373 | { |
| 374 | std::ifstream is("./input/books.json"); |
| 375 | auto data =jsoncons::json::parse(is); |
| 376 | |
| 377 | auto f = [](const std::string& /*location*/, jsoncons::json& price) |
| 378 | { |
| 379 | price = std::round(price.as<double>() - 1.0); |
| 380 | }; |
| 381 | |
| 382 | // make a discount on all books |
| 383 | jsonpath::json_replace(data, "$.books[*].price", f); |
| 384 | std::cout << pretty_print(data) << "\n\n"; |
| 385 | } |
| 386 | |
| 387 | void json_replace_example4() |
| 388 | { |
no test coverage detected