title: how to return a list/tuple of multiple dictionaries as an output from a function in Flask app?
body: <p>I have a requirement from a function to return something like this when a data is sent by <code>Postman</code>:</p>
  <p><code>[{&quot;spam&quot; : False, &quot;accuracy&quot; : &quot;0.2&quot;}, {&quot;multi&quot; : True, &quot;accuracy&quot; : &quot;0.5&quot;},{&quot;single&quot; : False, &quot;accuracy&quot; : &quot;0.3&quot;}]</code></p>
  <p>I have the following function as:</p>
  <pre><code>app = Flask(__name__,template_folder='templates') # instantiate flask api
   
  @app.route('/', methods=['POST'])
  def format_result(my,pred):
      result = ({'multi':False, 'accuracy':float(my[0])}, {'single':False, 'accuracy':float(my[1])}, {'spam':False, 'accuracy':float(my[2])})
  
      if pred == 'multi':
          result[0]['multi'] == True
      elif pred == 'single':
          result[1]['single'] == True
      else:
          result[2]['spam'] == True
      
      return result
  </code></pre>
  <p><code>my</code> is a <code>numpy array</code> say <code>my=np.array([0.13433,0.33353,0.24254])</code> so I was having problems serialisation so I thought of converting it to <code>float()</code></p>
  <p>I am still having problems as the error is:</p>
  <pre><code>TypeError: unhashable type: 'dict'
  
  </code></pre>