title: What is the simplest way to configure the indentation spacing on a Jackson ObjectMapper?
body: <p>I'm really struggling with the degree of complexity I am perceiving in solving this problem. As the title says: <strong>What is a simple way to create a Jackson <code>ObjectMapper</code> with a 4-space <code>PrettyPrinter</code>?</strong> </p>
  
  <p>Bonus points: How can I <strong>modify an existing</strong> <code>ObjectMapper</code> to make it pretty print 4 spaces?</p>
  
  <p>Through my research, I've found that the simplest way is to enable pretty printing generally is to set <code>INDENT_OUTPUT</code> on the mapper:</p>
  
  <pre><code>objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
  </code></pre>
  
  <p>However, this only enables the the <code>DefaultPrettyPrinter</code>, which has 2 spaces of indentation. I would like 4. To do this, it seems like I have to construct my own <code>ObjectMapper</code>, providing a <code>JsonFactory</code> with a <code>JsonGenerator</code> that has a <code>PrettyPrinter</code> that does 4 spaces. This is way too intense for something that is so so so simple on other platforms. Please tell me there is a simpler way.</p>