When using Jackson, System.out.println(new ObjectMapper().readTree(jsonStringObject)); prints the JSON with random spaces in between keys and values
问题 A very strange behavior. When I just print the System.out.println(jsonStringObject); it prints the JSON properly and well, but when I use Jackson's API, namely new ObjectMapper().readTree(jsonStringObject); it incorporates some random spaces. 回答1: A very strange behavior. Indeed. But see what the JsonNode class documentation says about the toString() method: Method that will produce developer-readable representation of the node; which may or may not be as valid JSON. If you want valid JSON