title: Android send json to Spring
body: <p>Spring Controller </p>
  
  <pre><code> @RequestMapping(value = "/login", produces="application/json;charset=UTF-8" ,method = RequestMethod.POST)
   @ResponseBody
   public int checkLoginInfo(@RequestParam Map&lt;String, String&gt; params) {
       User user=new Gson().fromJson((String) params.get("user"), User.class);
       return userService.getUserInfo(user);
   }   
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>var params={userid:$("#userid").val(),password:$("#password").val()}
  $ajax({method:"post",data:{user:JSON.stringify(params)},url:"foo.bar"});
  </code></pre>
  
  <p>It worked on website.
  But I don't know how to send that Json object for android.</p>
  
  <pre><code>data:{user:JSON.stringify(params)}
  </code></pre>
  
  <p>I have tested </p>
  
  <pre><code>    private static String makeJsonMsg() {
      String retMsg = "";
  
      JSONStringer jsonStringer = new JSONStringer();
  
      try {
  
  
          retMsg = jsonStringer.object()
                      .key("user").object()
                          .key("userid").value("userid")
                          .key("password").value("1234")
                      .endObject()
                  .endObject().toString();
  
      } catch (JSONException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  
      return retMsg;
  
  }
  </code></pre>
  
  <p>like that,
  But return 500 error.
  Do I need to add header or something else?</p>