title: Jackson: serialize non-initialized collection field as empty
body: <p>I have a POJO with a field or property, containing collection of objects, something like this:</p>
  
  <pre><code>public class Box {
  
      public List&lt;Items&gt; items;
  
  }
  </code></pre>
  
  <p>By default, value of <code>items</code> is null, and <strong>I do not want to initialize it with empty list</strong>. </p>
  
  <p>Now, if I try to serialize it with Jackson, I get <code>NullPointerException</code>. Is there a simple way to make Jackson not break on such value and serialize it as an empty collection: <code>[ ]</code>?</p>
  
  <p><strong>Note.</strong> This class is just a simplified example. In reality, there are a hundred of classes and a number of fields with different names in each of them, which are occasionally set to <code>null</code> sometimes somewhere in the code, breaking serialization in runtime.</p>