I have the following json:
{"john": 34, "alex": 56, "daniel": 90}
However I would like to add another value
{"harry": 78}
or alter an existing value
{"john": 39}
How would I go about doing this?
I have the following json:
{"john": 34, "alex": 56, "daniel": 90}
However I would like to add another value
{"harry": 78}
or alter an existing value
{"john": 39}
How would I go about doing this?
You can directly use concatenation operators without need of JSONB_INSERT
or JSON_SET
functions (as having no extra nested elements along with extra keys) such as
UPDATE tab
SET jsdata = jsdata || '{"harry":78}'::JSONB || '{"john":39}'::JSONB