JacksonObjectMapper { public Map<String, String> fromJsonToMap(byte[] bytes) throws IOException { TypeFactory factory = TypeFactory.defaultInstance(); MapType mapType = factory.constructMapType(HashMap.class, String.class, String.class); return objectMapper.readValue(bytes, mapType); } JacksonObjectMapper(ObjectMapper objectMapper); T fromJson(byte[] bytes, Class<T> type); T fromJson(byte[] bytes, Class<T> type, Class<?> view); Map<String, String> fromJsonToMap(byte[] bytes); byte[] toJson(Object object); byte[] toJson(Object object, Class<?> serializationView); byte[] toJson(Map<String, String> map); byte[] toPrettyJson(Object object, Class<?> serializationView); String prettyPrint(Object object); String prettyPrint(String json); void checkValidJson(byte[] bytes); T assign(T target, byte[] source);  }
@Test public void should_deserialize_json_to_map() throws Exception { String json = "{\"name\": \"walter\", \"lastname\": \"bates\"}"; Map<String, String> map = objectMapper.fromJsonToMap(json.getBytes(StandardCharsets.UTF_8)); assertThat(map.get("name")).isEqualTo("walter"); assertThat(map.get("lastname")).isEqualTo("bates"); }