If I insert the following object using ReJSON:
JSON.SET testing . '{"person":{"name":"John","surname":"Doe"}}'
Is there a way to "append" a nested structure? I would like to add "address.name" for an example to get the following JSON:
{
"person": {
"name": "John",
"surname": "Doe"
},
"address": {
"name": "Imaginary Street"
}
}
I was trying to use JSON.SET testing .address.name '"Imaginary Street 7"'
but this results in (error) ERR missing key at non-terminal path level
.
The docs read:
A key (with its respective value) is added to a JSON Object (in a Redis ReJSON data type key) if and only if it is the last child in the path.
Is "address.name" not the last child in the path? What am I doing wrong?
Since you're adding a dictionary ('address'), the way to go about this is:
Alternatively, if you do just:
you'll be able to use the command from your question without any errors.