@SuppressWarnings("unchecked") @Test public void testDeserializeList() throws SerializationException { String cardList = "[{\"number\":\"12345\"}]"; List<Card> cards = (List<Card>) JsonUtil.deserialize(cardList, new TypeReference<List<Card>>() {} ); Assert.assertEquals(cards.size(), 1); Assert.assertEquals(cards.get(0).getNumber(), "12345"); }
public static Object deserialize(String json, TypeReference<?> typeReference) throws SerializationException { try { logger.debug("Json string to deserialize {} ", json); return mapper.readValue(json, typeReference); } catch (IOException e) { logger.error("SerializationException {}", e.getMessage()); SerializationException serializationException = new SerializationException(e); throw serializationException; } }
JsonUtil { public static Object deserialize(String json, TypeReference<?> typeReference) throws SerializationException { try { logger.debug("Json string to deserialize {} ", json); return mapper.readValue(json, typeReference); } catch (IOException e) { logger.error("SerializationException {}", e.getMessage()); SerializationException serializationException = new SerializationException(e); throw serializationException; } } }
JsonUtil { public static Object deserialize(String json, TypeReference<?> typeReference) throws SerializationException { try { logger.debug("Json string to deserialize {} ", json); return mapper.readValue(json, typeReference); } catch (IOException e) { logger.error("SerializationException {}", e.getMessage()); SerializationException serializationException = new SerializationException(e); throw serializationException; } }  }
JsonUtil { public static Object deserialize(String json, TypeReference<?> typeReference) throws SerializationException { try { logger.debug("Json string to deserialize {} ", json); return mapper.readValue(json, typeReference); } catch (IOException e) { logger.error("SerializationException {}", e.getMessage()); SerializationException serializationException = new SerializationException(e); throw serializationException; } }  static String serialize(Object obj); static Object deserialize(String json, TypeReference<?> typeReference); }
JsonUtil { public static Object deserialize(String json, TypeReference<?> typeReference) throws SerializationException { try { logger.debug("Json string to deserialize {} ", json); return mapper.readValue(json, typeReference); } catch (IOException e) { logger.error("SerializationException {}", e.getMessage()); SerializationException serializationException = new SerializationException(e); throw serializationException; } }  static String serialize(Object obj); static Object deserialize(String json, TypeReference<?> typeReference); static ObjectMapper mapper; static final String TIMEZONE_UTC; static final String DATETIMEFORMAT; }