ObjectMapper mapper = new ObjectMapper();
try {
user = mapper.readValue(new StringReader(json), User.class);
} catch (JsonParseException e) {
e.printStackTrace();
} catch (JsonMappingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
User user;
String str=mapper.writeValueAsString(user);
时间: 2024-10-27 09:49:21