Wednesday, 29 July 2020

Self Quantified

Monday, 13 July 2020

Very good series of post on RxJava

Saturday, 15 February 2020

Thursday, 28 November 2019

How to stringify JSON for hashing and easy comparison in Java?

Or how to implement in Java?
    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);

Blog Archive