On the distinction fastjson with jackson when deserialization bool type

A: When a Mo value parameter deserialized into type bool

jackson serialization framework of treatment:

Based jackson 2.9.8 version of the source (NumberDeserializers._parseBoolean)

a bool value is normally assigned
value is null, or null
when Array value is, given (configurable mapper.configure (ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT, true), the support empty array is null; configurable mapper.configure (UNWRAP_SINGLE_VALUE_ARRAYS, true ), places the first element of the array determines true or false, for example, [true] [ "true"] , if a plurality of elements are also given)
when a digital value, 0 is false, the other (may be configured to true mapper.configure (ALLOW_COERCION_OF_SCALARS, false), not supported strong turn, are given)
value is a string, "true", "True" is true, "false", "False " is false, "null", "" is null, the other given (configurable mapper.configure (ALLOW_COERCION_OF_SCALARS, false), not supported strong turn, are given)

 

fastjson serialization framework of treatment:

Based fastjson 1.2.28 version of the source (BooleanCodec.deserialze)

1, true, to false, regular assignment
2, int type, if it is 1, true, or is to false
. 3, Number Type, if a strong turn int 1, true, or is to false
. 4, String type, if it is empty string, "null", "nULL" was null; if it is "true", "1" then true; if it is "false", "0" was false
4, otherwise throwing error can not cast to boolean

 

The difference is: the number, the type of treatment is not the same character string, this greater flexibility in Jackson

Guess you like

Origin www.cnblogs.com/dj3839/p/11325603.html