Wednesday, 29 July 2020

Self Quantified

https://quantified-self.io/

Monday, 13 July 2020

Very good series of post on RxJava

https://www.baeldung.com/rx-java

Saturday, 15 February 2020

Thursday, 28 November 2019

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

Or how to implement https://github.com/substack/json-stable-stringify 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