| 292 | } |
| 293 | |
| 294 | void function_length_example() |
| 295 | { |
| 296 | std::string data = R"( |
| 297 | { |
| 298 | "books": |
| 299 | [ |
| 300 | { |
| 301 | "title" : "A Wild Sheep Chase", |
| 302 | "author" : "Haruki Murakami", |
| 303 | "price" : 22.72 |
| 304 | }, |
| 305 | { |
| 306 | "title" : "The Night Watch", |
| 307 | "author" : "Sergei Lukyanenko", |
| 308 | "price" : 23.58 |
| 309 | }, |
| 310 | { |
| 311 | "title" : "The Comedians", |
| 312 | "author" : "Graham Greene", |
| 313 | "price" : 21.99 |
| 314 | }, |
| 315 | { |
| 316 | "title" : "The Night Watch", |
| 317 | "author" : "Phillips, David Atlee" |
| 318 | } |
| 319 | ] |
| 320 | } |
| 321 | )"; |
| 322 | |
| 323 | auto j = jsoncons::json::parse(data); |
| 324 | |
| 325 | jsoncons::json result1 = jsonpath::json_query(j, "length($.books[*])"); |
| 326 | std::cout << "(1) " << result1 << "\n\n"; |
| 327 | |
| 328 | jsoncons::json result2 = jsonpath::json_query(j, "length($.books[*].price)"); |
| 329 | std::cout << "(2) " << result2 << "\n\n"; |
| 330 | } |
| 331 | |
| 332 | void json_replace_example1() |
| 333 | { |
no test coverage detected