title: Python Sql Alchemy - How to jsonify a class object result from a database query
body: <p>Basically, I just want to json encode the results of my sql query.</p>
  
  <pre><code>x = db.session.query(User).filter_by(username = request.form['username'], password = request.form['password']).first()
    print vars(x)
  return jsonify(x)
  
  raise TypeError(repr(o) + " is not JSON serializable")
  
  TypeError: &lt; User WashingtonGeorge&gt; is not JSON serializable
  </code></pre>
  
  <p>Here is the result for the print vars(x)</p>
  
  <pre><code>{'_updated': None, 'username': u'WashingtonGeorge', 'password': u'Washington', '_sa_instance_state': &lt;sqlalchemy.orm.state.InstanceState object at 0x7fd12a50c8d0&gt;, 'firstname': u'George', 'lastname': u'Washington', '_created': None, 'fullname': u'George Washington', '_id': 1, 'email': u'WashingtonGeorge@yahoo.com'}
  </code></pre>