static String removeWhiteSpaceFromJson(String json) {

        //reparse the JSON to ensure that all whitespace formatting is uniform
        String flattend = FLAT_GSON.toJson(JsonParser.parseString(json));

        return flattend;
    }
@Test
    public void removeWhiteSpaceFromJson_removesNewLines() {
        String input = "{\n\"a\":123,\n\"b\":456\n}";
        String output = "{\"a\":123,\"b\":456}";

        assertThat(
            removeWhiteSpaceFromJson(input),
            is(output)
        );
    }