Closed
Description
Running the following function
void test_prob() {
auto doc = R"(
{
"a": {}
}
)"_json;
auto patch = R"(
[
{
"op": "add",
"path": "/a/b/c/d",
"value": 1
}
]
)"_json;
auto doc1 = doc.patch(patch);
auto d = doc1.dump(2);
printf("%s\n", d.c_str());
}
results in creating b
and c
parent objects:
{
"a": {
"b": {
"c": {
"d": 1
}
}
}
}
while according to RFC6902 it is an error:
"Because this operation is designed to add to existing objects and
arrays, its target location will often not exist. Although the
pointer's error handling algorithm will thus be invoked, this
specification defines the error handling behavior for "add" pointers
to ignore that error and add the value as specified.
However, the object itself or an array containing it does need to
exist, and it remains an error for that not to be the case. "
BTW, great library, thank you very much!