### Question:
FlatMapUtils { public static Map<String, Object> flatten(Map<String, Object> map) { return map.entrySet() .stream() .flatMap(FlatMapUtils::flatten) .collect(LinkedHashMap::new, (m, e) -> m.put("/" + e.getKey(), e.getValue()), LinkedHashMap::putAll); } private  FlatMapUtils(); static Map<String, Object> flatten(Map<String, Object> map);  }### Answer:
@Test void flatten() throws JsonProcessingException { String json = "{\"a\":1, \"b\":{\"b1\":2,\"b2\":3},\"c\":[{\"d\":4},5]}"; Map<String, Object> actualMap = (Map<String, Object>) FlatMapUtils.flatten(new ObjectMapper().readValue(json, Map.class)); assertThat(actualMap) .hasSize(5) .containsKeys("/a", "/b/b1", "/b/b2", "/c/0/d", "/c/1") .containsValues(1, 2, 3, 4, 5); }