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

Function more_json_query_examples

examples/src/jsonpath_examples.cpp:562–581  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

560}
561
562void more_json_query_examples()
563{
564 std::ifstream is("./input/books.json");
565 auto data =jsoncons::json::parse(is);
566
567 auto result1 = jsonpath::json_query(data, "$.books[1,1,3].title");
568 std::cout << "(1)\n" << pretty_print(result1) << "\n\n";
569
570 auto result2 = jsonpath::json_query(data, "$.books[1,1,3].title",
571 jsonpath::result_options::path);
572 std::cout << "(2)\n" << pretty_print(result2) << "\n\n";
573
574 auto result3 = jsonpath::json_query(data, "$.books[1,1,3].title",
575 jsonpath::result_options::nodups);
576 std::cout << "(3)\n" << pretty_print(result3) << "\n\n";
577
578 auto result4 = jsonpath::json_query(data, "$.books[1,1,3].title",
579 jsonpath::result_options::path | jsonpath::result_options::nodups);
580 std::cout << "(4)\n" << pretty_print(result4) << "\n\n";
581}
582
583void make_expression_examples()
584{

Callers 1

mainFunction · 0.85

Calls 3

parseFunction · 0.85
json_queryFunction · 0.85
pretty_printFunction · 0.85

Tested by

no test coverage detected