Use JSON key as text
Hello, I am using the following syntax to fetch data in a JSONB column:
This returns
my_val
as a json value which is equivalent to using ->
, how can I retrieve the data using the Postgres ->>
operation that returns the data as TEXT?2 Replies
Solution
aah, i had to change the first
->
to ->>
, doh!Hey 👋
If you expect it to be returned as string, make sure you use
$castTo<string>()
or something.