java对象怎么转成json数组 传到前台页面 在
1个回答
展开全部
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.2.3</version>
</dependency>
实现对象
List<Info> list= dao.goolist(name);
ObjectMapper om = new ObjectMapper();
String jsonStr = om.writeValueAsString(list);
out.println(jsonStr);
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.2.3</version>
</dependency>
实现对象
List<Info> list= dao.goolist(name);
ObjectMapper om = new ObjectMapper();
String jsonStr = om.writeValueAsString(list);
out.println(jsonStr);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询