Spring Boot04 之 使用别的json解析

来源:互联网 发布:office密码破解软件 编辑:程序博客网 时间:2024/05/04 15:20
个人习惯于使用fastJson来解析
<!-- 使用其它json转换 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
</dependency>

@RestController
@RequestMapping("/demo")
public class DemoController {

@RequestMapping("/getFastJson")
public String getFastJson(){
Demo demo=new Demo();
demo.setId(3);
demo.setName("李四");
return JSONObject.toJSONString(demo);
}
}
0 0
原创粉丝点击