title: Problems passing json to javascript in flask application
body: <p>I have the following route code:</p>
  
  <pre><code>@app.route('/getUser', methods=['GET'])
  def getUser():
      main = Main()
      value = request.args.get('user_name')
      user = main.getValues(value)
      print(json.dumps(user))
      return json.dumps(user)
  </code></pre>
  
  <p>which passes json to the template:</p>
  
  <pre><code>&lt;form&gt;
          &lt;label&gt;Nome usuario:&lt;/label&gt;
          &lt;input type="text" value="" name="user_name" id="user_name"/&gt;
          &lt;button id="btn_pesquisar"&gt;Pesquisar&lt;/button&gt; &lt;br&gt;
  
          &lt;label id="id"&gt;&lt;/label&gt; &lt;br&gt;
          &lt;label id="nome"&gt;&lt;/label&gt;
  
      &lt;/form&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script charset="utf-8"&gt;
          $('#btn_pesquisar').click(function(e){
              e.preventDefault();
              $.get("/getUser", { user_name: $('#user_name').val() })
              .done(function( data ) {
                  $('#id').html("Id: " + data.id) +
                  $('#nome').html("Nome: " + data.nome)
              });
          });
      &lt;/script&gt;
  </code></pre>
  
  <p>but when I ask for the javascript to put the json values ​​in the label, it puts <code>undefined</code>, however when I print the json before the return in the route function it returns the following json:<br>
  <code>{"id": 17, "nome": "teste", "idade": 22, "senha": "1234"}</code></p>
  
  <p>Can anyone help me put the values in the template?</p>