postgres nested jsonb query
You don't want #&gt;&gt;, but instead #&gt;, from the docs


  
  #&gt;   Get JSON object at specified path
  #&gt;&gt;  Get JSON object at specified path as text
  


Also, you should consider normalizing that. Storing json-arrays, of json-objects and expecting a query on those objects to be fast is insane.