Rows returned by pyodbc are not JSON serializable
<p>I am trying to retrieve the rows of a table using pyobc library in Python.</p>

<p>I was able to retrieve the tables and fields of a table successfully. Now I have a table named "apx_roomtypes" with the data as follows,</p>

<p><a href="https://i.stack.imgur.com/pxgqf.png" rel="noreferrer"><img src="https://i.stack.imgur.com/pxgqf.png" alt="enter image description here"></a></p>

<p>However, when I  append the pyodbc rows to a list and then try dumping the list to JSON I get the error</p>

<blockquote>
  <p>TypeError: (1, 'Standard', 'For 5 members', 123) is not JSON serializable</p>
</blockquote>

<p>Here is the <strong>python code</strong>:</p>

<pre><code>class execute_query:
    def GET(self,r):
          web.header('Access-Control-Allow-Origin',      '*')
          web.header('Access-Control-Allow-Credentials', 'true')
          cnxn = pyodbc.connect(connection_string)
          data = []
          cursor = cnxn.cursor()
          query = web.input().query
          cursor.execute(query)
          rows = cursor.fetchall()
          for row in rows:
              data.append(row)
          return json.dumps(data)
</code></pre>

<p>How can i fix this error?</p>