You can use @JsonFormat annotation,
public class MyClass {
@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
private List<String> value;
}
To work with this you need to have Jackson version min 2.7.0
. You can also use other available JsonFormat Features
For version 2.6.x
@Autowired private ObjectMapper mapper;
//...
mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
- Add this code to your
Initializer Class
. - Or you can directly configure
Jackson
in yourBean Configuration
These would solve the issue but it will be activated for every deserialization
process.