title: Sending variable in ResponseEntity
body: <p>I have a method in my controller that returns a String in JSON. It is working for string but not for a string variable. 
  Below example is working :</p>
  
  <pre><code>ResponseEntity&lt;String&gt;  {
      return new ResponseEntity&lt;String&gt;("{\"test\" :\"This is a String\"} ", httpHeaders, HttpStatus.OK);
  }
  </code></pre>
  
  <p>This is not working :</p>
  
  <pre><code>ResponseEntity&lt;String&gt;  {
  String newStr= "hello" ;
   return new ResponseEntity&lt;String&gt;("{\"test\" : newStr } ", httpHeaders, HttpStatus.OK);
  }
  </code></pre>
  
  <p>The returned string is processed as following:</p>
  
  <pre><code>function(response){                     
  
                              var json = JSON.stringify(response) ;
                              var jsonObject = $.parseJSON(json);                         
                              $('#location').val(jsonObject.test);                    
                      }
  </code></pre>
  
  <p>But location textbox is not updated.</p>