Suppose I have a value of type json
, say y
. One may obtain such a value through, for example, obj->'key'
, or any function that returns values of type json
.
This value, when cast to text
, includes quotation marks i.e. "y"
instead of y
. In cases where using json
types is unavoidable, this poses a problem, especially when we wish to compare the value with literal strings e.g.
select foo(x)='bar';
The API Brainstorm page suggests a from_json
function that will intelligently unwrap JSON strings, but I doubt that is available yet. In the meantime, how can one convert JSON strings to text without the quotation marks?