title: Return Object from controller to ajax
body: <p>Code below succesfully send String from jsp via ajax to controller and returning some String. </p>
  
  <p>How to send back (from controller to ajax) object which contains only getter and setter or Boolean?</p>
  
  <p>ajax:</p>
  
  <pre><code>        $.ajax({
          type: 'get',
          url : 'register/checkUsername',
          data : {'typedText' : typedText},
          success : function(data) {
              $('#doesUsernameAvailable').text("ok " + data);
          },
          error: function(){
              $('#doesUsernameAvailable').text('error');
          }
      }); 
  </code></pre>
  
  <p>controller:</p>
  
  <pre><code>    @RequestMapping(value = "/checkUsername", method = RequestMethod.GET)
      public @ResponseBody String checkUsername(String typedText, 
      HttpServletResponse response){
  
      //some code with return Boolean or Object
  
      return "text from controller";
  }
  </code></pre>