title: Return of API in JSON format
body: <p>Return of API in JSON format</p>
  <p>I'm creating an API in Flask that returns a LIST of data found, I need to convert this list to JSON format and return it to be handled in a WindowsForm (C#) application. It's giving an error when returning the data, searching I found some answers using jsonify() and json.dumps(), but it doesn't work.</p>
  <pre><code>def buscaIndicados(codigo):
  
      query = f&quot;SELECT idCliente, codIndicacao, dataVencimento, status FROM clientes WHERE codIndicado = '{codigo}'&quot;
  
      conn = mysql.connector.connect(host=servidor,database=dataBase,user=usuario,password=senha)
      cursor = conn.cursor()
      cursor.execute(query)
      row_headers = [x[0] for x in cursor.description]
      resultado = cursor.fetchall()
      cursor.close()
      conn.close()
  
      list_data = []
      for result in resultado:
          list_data.append(dict(zip(row_headers, result)))
  
      return jsonify(result=list_data)
  </code></pre>
  <p><strong>Database return:</strong></p>
  <pre><code>[{'idCliente': 8, 'codIndicacao': 123456789, 'dataVencimento': '2021-12-01 00:00:00', 'status': 0}, {'idCliente': 9, 'codIndicacao': 454121421, 'dataVencimento': '2021-11-25 00:00:00', 'status': 1}]
  </code></pre>
  <p><strong>ERROR:</strong></p>
  <pre><code>&quot;The view function did not return a valid response. The&quot;
  TypeError: The view function did not return a valid response. The function either returned None or ended without a return statement.
  </code></pre>