一个测试用例
javabean转json
@Test
@Rollback(false)
public void policyQueryTest() throws Exception {
// 查询数据
String id = "402892816136971701613699f23f0002";
DmPolicy tem = policyService.queryPolicy(id);
System.out.println("1111111111111111111111111111111111111111111111111111");
ObjectMapper mapper = new ObjectMapper();
//javabean转json
String jsonString = mapper.writeValueAsString(tem);
System.out.println(jsonString);
System.out.println("1111111111111111111111111111111111111111111111111111");
}
}
json转 javabean
DmPolicy zz = mapper.readValue(jsonString, DmPolicy.class);