Casting text type column to json type in Postgresql Casting text type column to json type in Postgresql json json

Casting text type column to json type in Postgresql


PostgreSQL is fussy about data types, and won't implicitly convert from text to json even though they seem like they're both textual types.

You must use an explicit cast, e.g.

UPDATE category_query_copyset json_queries = CAST(query_json AS json)


I don't know why but for some reasons, using cast function does not work on my side. This is what has worked

UPDATE category_query_copyset json_queries = to_json(query_json)