FasterXML/jackson-databind — pull request #384 by yinzara (2014-01-10 03:06:59+00:00)
Title: Added new UNWRAP_SINGLE_VALUE_ARRAYS DeserializationFeature

Fixes issue # 381

By default the new feature is disabled but if enabled (i.e. "objectMapper.enable(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS);"), any data bind to single element values (i.e. not a list or array) will allow the JSON to contain a single element array and will automatically unwrap that array value. See issue for more detailed information.

For example, let's say you had a class:

public class FooBean { public String bar; }

Without the feature enabled the deserializing following JSON into a FooBean would throw a JsonMappingException:
{ "bar" : [ "barValue" ] }

with the feature enabled, JSON processing would be successful and the FooBean would have the "bar" field set to "barValue".

However:
{ "bar" : [ "barValue", "barValue2" ] } (i.e. if the array contains more than a single element)
would still throw a JsonMappingException

All deserializers supported by jackson-databind have been updated to support the new feature.

Custom JsonDeserializer(s) developed externally to jackson-databind will need to be updated to read this feature's configured value to mimic identical behavior. However since the StdDeserializer and FromStringDeserializer have been updated, any custom deserializers that extend from those classes may function with the new feature without any modification.