title: How do I get the compact/minified form of pretty-printed JSON in Java?
body: <p><a href="https://stackoverflow.com/questions/6176881/how-do-i-make-jackson-pretty-print-the-json-content-it-generates">How do I make Jackson&#39;s build() method pretty-print its JSON output?</a> is an example that pretty-prints the JSON string.</p>
  <p>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?</p>
  <p>I need to convert this:</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;one&quot; : &quot;AAA&quot;,
    &quot;two&quot; : [ &quot;B B&quot;, &quot;CCC&quot; ],
    &quot;three&quot; : {
      &quot;four&quot; : &quot;D D&quot;,
      &quot;five&quot; : [ &quot;EEE&quot;, &quot;FFF&quot; ]
    }
  }
  </code></pre>
  <p>to this:</p>
  <pre class="lang-json prettyprint-override"><code>{&quot;one&quot;:&quot;AAA&quot;,&quot;two&quot;:[&quot;B B&quot;,&quot;CCC&quot;],&quot;three&quot;:{&quot;four&quot;:&quot;D D&quot;,&quot;five&quot;:[&quot;EEE&quot;,&quot;FFF&quot;]}}
  </code></pre>
  <p>I tried to remove '\n', '\t', and ' ' characters; but there may be some of these characters in values so I can't do that.</p>
  <p>What else can be done?</p>