I have a TEXT column in my table (it's actually 'character varying'), but the data in the column is valid json. How can I access fields in this column using Postgres 9.3's new JSON functions?
What I basically want is a way to be able to do:
SELECT mycolumn->'myfield' from mytable;
Do I need to convert the entire column to the native JSON datatype, or is there an easy/efficient way to cast the cells?
You need a type cast:
SELECT mycolumn::json->'myfield' FROM mytable;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With