MCPcopy Create free account
hub / github.com/danielaparker/jsoncons / jsonpath_union

Function jsonpath_union

examples/src/jsonpath_examples.cpp:502–530  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

500}
501
502void jsonpath_union()
503{
504 auto root = jsoncons::json::parse(R"(
505{
506 "firstName": "John",
507 "lastName" : "doe",
508 "age" : 26,
509 "address" : {
510 "streetAddress": "naist street",
511 "city" : "Nara",
512 "postalCode" : "630-0192"
513 },
514 "phoneNumbers": [
515 {
516 "type" : "iPhone",
517 "number": "0123-4567-8888"
518 },
519 {
520 "type" : "home",
521 "number": "0123-4567-8910"
522 }
523 ]
524} )");
525
526 std::string path = "$..[@.firstName,@.address.city]";
527 jsoncons::json result = jsonpath::json_query(root,path);
528
529 std::cout << result << "\n";
530}
531
532void flatten_and_unflatten()
533{

Callers 1

mainFunction · 0.85

Calls 2

parseFunction · 0.85
json_queryFunction · 0.85

Tested by

no test coverage detected