SELECT (((mytable.ajsonbcolumn -> ‘somedata’::text) -> ‘nested’::text) ->> ‘first_name’::text) AS fname FROM mytable
It’s casting the untyped literal constants (somedata, neated, first_name) to text because everything must be typed. It is not casting the first or intermediate jsonb results to text. The final output is text because of the ->> operator.
:: binds more tightly than the other operators.
Jsonb->('somedata'::text)
David J.