users@jersey.java.net

unmarshalling JSON empty list

From: Matthew M. Boedicker <matthewm_at_boedicker.org>
Date: Mon, 12 Jul 2010 11:11:55 -0400

When I send this JSON to my web service:

{"input":[]}

I get in my class a List<String> with one element that is an empty string.
What I would like is a List<String> with 0 elements. Is there any way to
make it unmarshal to that?

This is the class that represents the JSON:

@XmlRootElement
public class ListTest {

  public void setInput(List<String> val) {
    this.input = val;
  }
  public List<String> getInput() {
    return this.input;
  }

  private List<String> input = new ArrayList<String>();
}