@Test public void testSerialize() throws JsonProcessingException { String jsonString = "{\"method\":\"method\",\"params\":[],\"id\":\"id\"}"; JsonRpcV1Request request = new JsonRpcV1Request("id", "method"); assertEquals( jsonString, JsonUtil.serialize(request) ); class WrongClass { private String field; } assertNull(JsonUtil.serializeNoException(new WrongClass())); }
public static String serialize(Object object) throws JsonProcessingException { return objectMapper.writeValueAsString(object); }
JsonUtil { public static String serialize(Object object) throws JsonProcessingException { return objectMapper.writeValueAsString(object); } }
JsonUtil { public static String serialize(Object object) throws JsonProcessingException { return objectMapper.writeValueAsString(object); }  }
JsonUtil { public static String serialize(Object object) throws JsonProcessingException { return objectMapper.writeValueAsString(object); }  static T treeToValue(JsonNode jsonNode, Class<T> klass); static T treeToValueNoException(JsonNode jsonNode, Class<T> klass); static T treeToValueNoException(JsonNode jsonNode, TypeReference<?> valueTypeRef); static JsonNode toJsonNode(Object object); static T deserialize(String jsonString, Class<T> klass); static T deserialize(URL url, Class<T> klass); static T deserializeNoException(String jsonString, Class<T> klass); static String serializeNoException(Object object); static String serialize(Object object); static ArrayNode createArrayNode(); static JsonNode readTree(String string); }
JsonUtil { public static String serialize(Object object) throws JsonProcessingException { return objectMapper.writeValueAsString(object); }  static T treeToValue(JsonNode jsonNode, Class<T> klass); static T treeToValueNoException(JsonNode jsonNode, Class<T> klass); static T treeToValueNoException(JsonNode jsonNode, TypeReference<?> valueTypeRef); static JsonNode toJsonNode(Object object); static T deserialize(String jsonString, Class<T> klass); static T deserialize(URL url, Class<T> klass); static T deserializeNoException(String jsonString, Class<T> klass); static String serializeNoException(Object object); static String serialize(Object object); static ArrayNode createArrayNode(); static JsonNode readTree(String string);  }