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

Function add_and_create_if_missing

examples/src/jsonpointer_examples.cpp:523–537  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

521}
522
523void add_and_create_if_missing()
524{
525 std::vector<std::string> keys = {"foo","bar","baz"};
526
527 jsonpointer::json_pointer ptr;
528 for (const auto& key : keys)
529 {
530 ptr /= key;
531 }
532
533 json doc;
534 jsonpointer::add(doc, ptr, "str", true);
535
536 std::cout << pretty_print(doc) << "\n\n";
537}
538
539void add_if_absent_and_create_if_missing()
540{

Callers 1

mainFunction · 0.85

Calls 2

addFunction · 0.85
pretty_printFunction · 0.85

Tested by

no test coverage detected