PostgreSQL Nested JSON Querying
This is because operator ->>
gets JSON array element as text. You need a cast to convert its result back to JSON.
You can eliminate this redundant cast by using operator ->
:
select person->'dogs'->0->'breed' from people where id = 77;