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

Function get_and_create_if_missing

examples/src/jsonpointer_examples.cpp:507–521  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

505}
506
507void get_and_create_if_missing()
508{
509 std::vector<std::string> keys = {"foo","bar","baz"};
510
511 jsonpointer::json_pointer ptr;
512 for (const auto& key : keys)
513 {
514 ptr /= key;
515 }
516
517 json doc;
518 json result = jsonpointer::get(doc, ptr, true);
519
520 std::cout << pretty_print(doc) << "\n\n";
521}
522
523void add_and_create_if_missing()
524{

Callers 1

mainFunction · 0.85

Calls 2

pretty_printFunction · 0.85
getFunction · 0.50

Tested by

no test coverage detected