Created
December 8, 2022 23:45
-
-
Save markscottwright/dc047a323ba7e48029d203206976c4be to your computer and use it in GitHub Desktop.
How to pretty print json using java and Jackson
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HashMap<String, Object> map = new ObjectMapper().readValue(jsonString, new TypeReference<HashMap<String, Object>>() {}); | |
String prettyJson = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT).writeValueAsString(map); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment