title: How to query a JSON element
body: <p>Let's say I have a Postgres database (9.3) and there is a table called <code>Resources</code>. In the <code>Resources</code> table I have the fields <code>id</code> which is an int and <code>data</code> which is a JSON type.</p>
  
  <p>Let's say I have the following records in said table.</p>
  
  <ul>
  <li>1, {'firstname':'Dave', 'lastname':'Gallant'} </li>
  <li>2, {'firstname':'John', 'lastname':'Doe'}</li>
  </ul>
  
  <p>What I want to do is write a query that would return all the records in which the data column has a json element with the lastname equal to "Doe"</p>
  
  <p>I tried to write something like this:</p>
  
  <pre><code>records = db_session.query(Resource).filter(Resources.data-&gt;&gt;'lastname' == "Doe").all()
  </code></pre>
  
  <p>Pycharm however is giving me a compile error on the "->>"</p>
  
  <p>Does anyone know how I would write the filter clause to do what I need?</p>