Top Description Inners Fields Methods
com.fasterxml.jackson.annotation

public @Interface JsonFormat

extends Annotation
Annotations
@Target:ANNOTATION_TYPE, FIELD, METHOD, PARAMETER, TYPE
@Retention:RUNTIME
@JacksonAnnotation
Imports
java.lang.annotation.*, java.util.Locale, .TimeZone

General-purpose annotation used for configuring details of how values of properties are to be serialized. Unlike most other Jackson annotations, annotation does not have specific universal interpretation: instead, effect depends on datatype of property being annotated (or more specifically, deserializer and serializer being used).

Common uses include choosing between alternate representations -- for example, whether java.util.Date is to be serialized as number (Java timestamp) or String (such as ISO-8601 compatible time value) -- as well as configuring exact details with pattern property.

As of Jackson 2.6, known special handling includes:

Since
2.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
JsonFormat.Feature

Set of features that can be enabled/disabled for property annotated.

public static class
JsonFormat.Features

Helper class that encapsulates information equivalent to java.lang.Boolean valued java.util.EnumMap.

public static enum
JsonFormat.Shape

Value enumeration used for indicating preferred Shape; translates loosely to JSON types, with some extra values to indicate less precise choices (i.e. allowing one of multiple actual shapes)

public static class
JsonFormat.Value

Helper class used to contain information from a single JsonFormat annotation.

Field Summary

Modifier and TypeField and Description
public static final String
DEFAULT_LOCALE

Value that indicates that default java.util.Locale (from deserialization or serialization context) should be used: annotation does not define value to use.

public static final String
DEFAULT_TIMEZONE

Value that indicates that default java.util.TimeZone (from deserialization or serialization context) should be used: annotation does not define value to use.

Method Summary

Modifier and TypeMethod and Description
public OptBoolean
lenient()

Property that indicates whether "lenient" handling should be enabled or disabled.

public String
locale()

java.util.Locale to use for serialization (if needed).

public String
pattern()

Datatype-specific additional piece of configuration that may be used to further refine formatting aspects.

public JsonFormat.Shape
shape()

Structure to use for serialization: definition of mapping depends on datatype, but usually has straight-forward counterpart in data format (JSON).

public String
timezone()

java.util.TimeZone to use for serialization (if needed).

public JsonFormat.Feature[]
with()

Set of JsonFormat.Features to explicitly enable with respect to handling of annotated property.

public JsonFormat.Feature[]
without()

Set of JsonFormat.Features to explicitly disable with respect to handling of annotated property.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString