How do I make Jackson's build() method pretty-print its JSON output? is an example that pretty-prints the JSON string.
I need to take the pretty-printed version of JSON string and then convert it to the compact/minified form. How can it be done?
I need to convert this:
{
"one" : "AAA",
"two" : [ "B B", "CCC" ],
"three" : {
"four" : "D D",
"five" : [ "EEE", "FFF" ]
}
}
to this:
{"one":"AAA","two":["B B","CCC"],"three":{"four":"D D","five":["EEE","FFF"]}}
I tried to remove '\n', '\t', and ' ' characters; but there may be some of these characters in values so I can't do that.
What else can be done?