Updating and deleting values in a json object in Postgresql 14

18 views Asked by At

The table has a json field that stores data in the following form:

[{"9":[111,222]},{"11":[444,555]}]

I need to update the values of a json object. For example, the values in the update parameters come in this form:

 param1 = 11;
 param2 = [444,666,777];

What is the best way to update a field to get data in this form?

[{"9":[111,222]},{"11":[444,666,777]}]

What is the best way to update a field to remove data from a json string when, for example, parameters with such values arrive?

param1 = 11;
param2 = [null];

Need to get

[{"9":[111,222]}]

Thanks

0

There are 0 answers