Postgresql - update or delete a value from a nested jsonb element

Viewed 8469

Is there a way to delete/update a nested json key object (not array) for example the following json:

{
  "top": {
    "nested": {
       "leaf": 1
    }
  }  
}

how would I delete/update the leaf element?

I tried

SELECT jsonb '{"top": {"nested": {"leaf" : 1}}' - '{top,nested,leaf}'

but no luck

1 Answers
Related