Created
November 2, 2018 13:50
-
-
Save biniama/7d9c7611061c7c85588f1314c4e8e398 to your computer and use it in GitHub Desktop.
Convert POJO to JSON
This file contains 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
import com.fasterxml.jackson.databind.ObjectMapper; | |
private static void pojoToJson(Object object) throws JsonProcessingException { | |
ObjectMapper mapper = new ObjectMapper(); | |
log.info(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(object)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment