RawSushi's Tech Journal
My online tech scrapbook where I keep my notes in case I need to look them up later
Tuesday, December 4, 2012
Jackson Pretty Print
Some of the solutions posted online is deprecated.
Here's the way to do it with a recent version of Jackson.
ObjectWriter jsonWriter = (new ObjectMapper()).writerWithDefaultPrettyPrinter();
String result = jsonWriter.writeValueAsString(obj);
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment