ObjectMapper mapper = new ObjectMapper(); try { MyObject myObject = mapper.readValue(jsonString, MyObject.class); } catch (JsonParseException e) { e.printStackTrace(); } catch (JsonMappingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } Gson gson = new Gson(); try { String jsonString = gson.toJson(myObject); } catch (JsonGenerationException e) { e.printStackTrace(); } ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); mapper.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false);


上一篇:
下一篇:
切换中文