title: I want to make Pretty JSON formatting in Flask
body: <p>I would like to output a nice looking JSON on my flask website (API website) , but my JSON file does not want to format properly.</p>
  
  <p>I have tried multiple things :</p>
  
  <pre><code>return json.loads(json.dumps(json_text, indent=4))
  return json.dumps(json_text, indent=4)
  return jsonify(json_text)
  </code></pre>
  
  <p>json_it() function:</p>
  
  <pre><code>def json_it(self):
      input_part = {"amount": self.amount, "currency": str(self.input_currency)}
      output_part = self.result
      return {"input": input_part, "output": output_part}
  </code></pre>
  
  <p>Flask API code:</p>
  
  <pre><code>converter = CurrencyConvert(float(amount), input_currency, output_currency)
  json_text = converter.json_it()
  the_output = json.dumps(json_text, indent=10)
  print(the_output)
  return the_output, 200
  </code></pre>
  
  <p>CurrencyConvert is taking those 3 parameters and makes dictionaty from it as you can see in the output that prints it. ( that one should not be the problem )</p>
  
  <p>OUTPUT ( API ) : 
  If I print it:</p>
  
  <pre><code>{
            "input": {
                      "amount": 10.92,
                      "currency": "GBP"
            },
            "output": {
                      "AED": 46.023890640000005,
            }
  }
  </code></pre>
  
  <p>If I return it:</p>
  
  <pre><code>{ "input": { "amount": 10.92, "currency": "GBP" },"output": {"AED": 46.023890640000005,}}
  </code></pre>
  
  <p>I think similar questions were asked, but I could not find the solution that could help me.</p>