Spring Controller
 @RequestMapping(value = "/login", produces="application/json;charset=UTF-8" ,method = RequestMethod.POST)
 @ResponseBody
 public int checkLoginInfo(@RequestParam Map<String, String> params) {
     User user=new Gson().fromJson((String) params.get("user"), User.class);
     return userService.getUserInfo(user);
 }   
HTML
var params={userid:$("#userid").val(),password:$("#password").val()}
$ajax({method:"post",data:{user:JSON.stringify(params)},url:"foo.bar"});
It worked on website. But I don't know how to send that Json object for android.
data:{user:JSON.stringify(params)}
I have tested
    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;
}
like that, But return 500 error. Do I need to add header or something else?