Working with JSON in Postgres
Append to a JSON array
UPDATE purchases SET items_purchased = items_purchased ||
'{"name": "LG Ultrawide Monitor",
"price": 190,
"productid": 8}' ::jsonb
WHERE id=1;
UPDATE purchases SET items_purchased = items_purchased ||
'{"name": "LG Ultrawide Monitor",
"price": 190,
"productid": 8}' ::jsonb
WHERE id=1;