title: How to make Jersey/Jackson serialize empty list; single element list as an array
body: <p>Using Jersey and Jackson to create a REST interface, how do I get List fields to be serialized as a list when there are 0 or 1 elements in them. For example:</p>
  
  <pre><code>@XmlRootElement(name="foo")
  public class Foo {
    @XmlElement
    public List&lt;Bar&gt; getBars() {
      return this.bars;
    }
  }
  
  @Path("foo")
  public FooResource {
    @GET
    public Foo getFoo() {
      return theFoo;
    }
  }
  </code></pre>
  
  <p>When bars has no elements, the result serializes as <code>null</code> and when it contains a single element, it serializes as that element, not an array containing a single element. Is there a way to get these to always serialize as an array?</p>
  
  <p>For reference, I'm using Jersey 1.10 and Jackson 1.9.2.</p>