I'm trying to append an element to an array. But i cannot ensure that the array alread exists. So it should be created if not.
This example works:
Source json:
{
"data": []
}
Patch doc:
[{
"op":"add",
"path":"/data/-",
"value": "foo"
}]
But in this case it will not append anything:
Source json:
{}
I tried a solution by adding first an empty array and then appending, but this will always clear existing entries:
[{
"op":"add",
"path":"/scores",
"value": []
},
{
"op":"add",
"path":"/scores/-",
"value": {
"time":1512545873
}
}]
Have i missed something or is there no solution for this in the spec?