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);
Map map = om.readValue(jsonData, HashMap.class);
String json = om.writeValueAsString(map);
}
File generation with SBT
11 years ago
No comments:
Post a Comment