| 339 | } |
| 340 | |
| 341 | void json_replace_example2() |
| 342 | { |
| 343 | jsoncons::json j; |
| 344 | try |
| 345 | { |
| 346 | j = jsoncons::json::parse(R"( |
| 347 | {"store": |
| 348 | {"book": [ |
| 349 | {"category": "reference", |
| 350 | "author": "Margaret Weis", |
| 351 | "title": "Dragonlance Series", |
| 352 | "price": 31.96}, |
| 353 | {"category": "reference", |
| 354 | "author": "Brent Weeks", |
| 355 | "title": "Night Angel Trilogy", |
| 356 | "price": 14.70 |
| 357 | }]}} |
| 358 | )"); |
| 359 | } |
| 360 | catch (const std::exception& e) |
| 361 | { |
| 362 | std::cout << e.what() << "\n"; |
| 363 | } |
| 364 | |
| 365 | std::cout << ("1\n") << pretty_print(j) << "\n"; |
| 366 | |
| 367 | jsonpath::json_replace(j,"$..book[?(@.price==31.96)].price", 30.9); |
| 368 | |
| 369 | std::cout << ("2\n") << pretty_print(j) << "\n\n"; |
| 370 | } |
| 371 | |
| 372 | void json_replace_example3() |
| 373 | { |
no test coverage detected