springMVC json string and returns the object json

springMVC objects and return json json Control method returns a string depends on the type defined above;

1, json string

@ResponseBody

public String test()

"{\"id\":166,\"username\":\"20130201335\",\"name\":\"马杰\",\"mobile\":\"18786619062\",\"professional\":null,\"educational\":null,\"hospitallevel\":null,\"birthday\":\"2017-05-25\",\"workunit\":\"\",\"email\":\"[email protected]\"}"

 

2, json objects

@ResponseBody

public JsonNode test()

{
    "id": 181,
    "username": "20130201350",
    "name": "刘涛",
    "mobile": "18786602125",
    "professional": null,
    "educational": null,
    "hospitallevel": null,
    "birthday": "2017-05-25",
    "workunit": "",
    "email": "[email protected]"
}

Guess you like

Origin blog.csdn.net/liuqianduxin/article/details/84992102