JSONB_SET
Returns a copy of JSON with a new value at the given path.
Syntax
JSONB_SET(<json>, '{<path>}', <new value>)
JSONB_SET(<json>, '{<path>}', <new value>, <create if missing>)
The path is written as a list of keys in curly braces: '{name}' is a top-level key, '{address,city}' a nested one. The new value must be JSON, so text goes in double quotes: '"Liam"'. If the key doesn't exist, it's added; a fourth argument of false turns that off.