com.fasterxml.jackson.databind.ser.impl

Class BeanAsArraySerializer

  • All Implemented Interfaces:
    JsonFormatVisitable, SchemaAware, ContextualSerializer, ResolvableSerializer


    public class BeanAsArraySerializer
    extends BeanSerializerBase
    Specialized POJO serializer that differs from BeanSerializer in that instead of producing a JSON Object it will output a JSON Array, omitting field names, and serializing values in specified serialization order. This behavior is usually triggered by using annotation JsonFormat or its equivalents.

    This serializer can be used for "simple" instances; and will NOT be used if one of following is true:

    • Unwrapping is used (no way to expand out array in JSON Object)
    • Type information ("type id") is to be used: while this could work for some embedding methods, it would likely cause conflicts.
    • Object Identity ("object id") is used: while references would work, the problem is inclusion of id itself.
    Note that it is theoretically possible that last 2 issues could be addressed (by reserving room in array, for example); and if so, support improved.

    In cases where array-based output is not feasible, this serializer can instead delegate to the original Object-based serializer; this is why a reference is retained to the original serializer.

    Since:
    2.1

Copyright © 2014-2015 FasterXML. All Rights Reserved.