| 341 | } |
| 342 | |
| 343 | void jsonpointer_get_examples() |
| 344 | { |
| 345 | { |
| 346 | json j(jsoncons::json_array_arg, {"baz","foo"}); |
| 347 | json& item = jsonpointer::get(j,"/0"); |
| 348 | std::cout << "(1) " << item << '\n'; |
| 349 | } |
| 350 | { |
| 351 | const json j(jsoncons::json_array_arg, {"baz","foo"}); |
| 352 | const json& item = jsonpointer::get(j,"/1"); |
| 353 | std::cout << "(2) " << item << '\n'; |
| 354 | } |
| 355 | { |
| 356 | json j(jsoncons::json_array_arg, {"baz","foo"}); |
| 357 | |
| 358 | std::error_code ec; |
| 359 | json& item = jsonpointer::get(j,"/1",ec); |
| 360 | std::cout << "(4) " << item << '\n'; |
| 361 | } |
| 362 | { |
| 363 | const json j(jsoncons::json_array_arg, {"baz","foo"}); |
| 364 | |
| 365 | std::error_code ec; |
| 366 | const json& item = jsonpointer::get(j,"/0",ec); |
| 367 | std::cout << "(5) " << item << '\n'; |
| 368 | } |
| 369 | } |
| 370 | |
| 371 | void jsonpointer_address_example() |
| 372 | { |