I had a column in PostgreSQL which has text datatype (data text)
the data in this column will be like
[
{"code":"ABC","Value":"A1"},
{"code":"Name","Value":"Ramesh"},
{"code":"Age","paramValue":"24"}
]
in the above json I want to update value such as {"code":"Age","paramValue":"30"}
the data would be like
[
{"code":"ABC","Value":"A1"},
{"code":"Name","Value":"Ramesh"},
{"code":"Age","paramValue":"30"}
]
since it TEXT field I tries different ways but couldn't succeed
I tried selecting first
SELECT id, data ::json->'"code":"ABC"' as name
FROM my_table;
I am getting error ERROR: invalid input syntax for type json DETAIL: Expected "," or "}", but found