title: python list of dictionaries
body: <p>I have a simple code to fetch users from db using sqlalchemy and return them as json. My problem is how to format the output to get something like this:</p>
  
  <pre><code>{"results": [{"id":1, "username":"john"},{"id":2,"username":"doe"}]}
  </code></pre>
  
  <p>my code outputs an error which I cant seem to fix being a newbie in python:</p>
  
  <pre><code>d = []
  
  for user in Users.query.all():
      v = {}
      for columnName in Users.__table__.columns.keys():
          v[columnName] = getattr( user, columnName )
  
      d.append( v )
  
  return jsonify( d )
  </code></pre>
  
  <p>The code says:</p>
  
  <pre><code>ValueError: dictionary update sequence element #0 has length 11; 2 is required
  </code></pre>
  
  <p>Thanks.</p>