title: How to return dictonary or json if I use psycopg2?
body: <p>I try to use RealDictCursor:</p>
  
  <pre><code>cur = conn.cursor(cursor_factory = psycopg2.extras.RealDictCursor)
  cur.execute('SELECT * FROM items')
  res = cur.fetchall()
  print(res)
  print(type(res[0]))
  </code></pre>
  
  <p>But it doesn't work. Result:</p>
  
  <pre><code>[RealDictRow([('id', 1), ('name', 'apple')]), RealDictRow([('id', 2), ('name', 'pen')])]
  &lt;class 'psycopg2.extras.RealDictRow'&gt;
  </code></pre>
  
  <p>I need a dictonary, output like this:</p>
  
  <pre><code>[{"id": 1, "name": "apple"}, {"id": 2, "name": "pen"}]
  &lt;class 'dict'&gt;
  </code></pre>
  
  <p>Yes, I know that I can to make dict with cycle <strong>for</strong>. But I have the table with 10000 rows and I need to show 10000 items fast. (I think that cycle <strong>for</strong> isn't very fast to solve my problem. <strong>Is it true? Can you give me a advice to solve my problem very fast with a minimum amount of time</strong>)</p>
  
  <p>How can I get it?</p>
  
  <p>PS:
  I need it for API service by Flask so after this I need to return it like this:</p>
  
  <pre><code>return jsonify({my_dictonary_sql_query})
  </code></pre>