| 310 | } |
| 311 | |
| 312 | void jsonpointer_error_example() |
| 313 | { |
| 314 | auto j = json::parse(R"( |
| 315 | [ |
| 316 | { "category": "reference", |
| 317 | "author": "Nigel Rees", |
| 318 | "title": "Sayings of the Century", |
| 319 | "price": 8.95 |
| 320 | }, |
| 321 | { "category": "fiction", |
| 322 | "author": "Evelyn Waugh", |
| 323 | "title": "Sword of Honour", |
| 324 | "price": 12.99 |
| 325 | } |
| 326 | ] |
| 327 | )"); |
| 328 | |
| 329 | try |
| 330 | { |
| 331 | json result = jsonpointer::get(j, "/1/isbn"); |
| 332 | std::cout << "succeeded?" << '\n'; |
| 333 | std::cout << result << '\n'; |
| 334 | } |
| 335 | catch (const jsonpointer::jsonpointer_error& e) |
| 336 | { |
| 337 | std::cout << "Caught jsonpointer_error with category " << e.code().category().name() |
| 338 | << ", code " << e.code().value() |
| 339 | << " and message \"" << e.what() << "\"" << '\n'; |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | void jsonpointer_get_examples() |
| 344 | { |