'{} {}'
isn't valid JSON. A Java mapping terms, a java.util.List
would be a JSON array ([]
). So a valid input would be -d "[ \"hello\", \"world\" ]"
. Since your list is just a of a simple type String, you don't need any curly brackets {}
, and those signify JSON objects.
This is just simple Strings. If you want an array of object, then you would need something like "[{\"word\" : \"hello\"},{\"word\": \"world\"}]"
, where the list List
type would be something like
public class Hello {
private String word;
public String getWord() { return word; }
public void setWord(String word) { this.word = word; }
}
So you would use List<Hello>
. Also you need to make sure you have a JSON provider registered with the application (for POJO mapping). Some providers will auto-register, others won't If you need help with this, then please provide the JAX-RS implementation you are using, and whether or not you are using Maven.