File generation with SBT
10 years ago
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; public static void stringify(final String jsonPath) throws Exception { final byte[] bytes = Files.readAllBytes(Paths.get(jsonPath)); final String jsonData = new String(bytes); ObjectMapper om = new ObjectMapper(); om.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true); Mapmap = om.readValue(jsonData, HashMap.class); String json = om.writeValueAsString(map); }