I have the following data structure:
create table test (tags VARCHAR, tags_json VARCHAR);
insert into test (tags, tags_json)
values ('A B', '["A", "B"]')
And I want to convert the column tags to a JSON column. If I were to do it with the tags_json column is pretty easy:
select tags_json::JSON from test
But when I run it using the tags column,
select tags::JSON from test
I get
SQL Error [22P02]: ERROR: invalid input syntax for type json
How can I convert the column tags to a JSON column in postgresql?
'A B'to be in a JSON representation?'["A", "B"]'