19

I have a json column, I want to select it as text, like :

select json_to_string(my_json_col) from my_table

How is that done ?

1 Answer 1

28

I would try:

SELECT CAST(my_json_col AS VARCHAR) FROM my_table

or

SELECT my_json_cal::varchar FROM my_table

(I haven't worked with JSON in PostgreSQL yet, but the above is how PostgreSQL handles type conversions)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.