1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<!-- NewPage -->
3<html lang="en">
4<head>
5<!-- Generated by javadoc (version 1.7.0_67) on Thu Jul 16 17:03:17 PDT 2015 -->
6<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
7<title>JsonFormat (Jackson-annotations 2.6.0 API)</title>
8<meta name="date" content="2015-07-16">
9<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
10</head>
11<body>
12<script type="text/javascript"><!--
13    if (location.href.indexOf('is-external=true') == -1) {
14        parent.document.title="JsonFormat (Jackson-annotations 2.6.0 API)";
15    }
16//-->
17</script>
18<noscript>
19<div>JavaScript is disabled on your browser.</div>
20</noscript>
21<!-- ========= START OF TOP NAVBAR ======= -->
22<div class="topNav"><a name="navbar_top">
23<!--   -->
24</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
25<!--   -->
26</a>
27<ul class="navList" title="Navigation">
28<li><a href="../../../../com/fasterxml/jackson/annotation/package-summary.html">Package</a></li>
29<li class="navBarCell1Rev">Class</li>
30<li><a href="class-use/JsonFormat.html">Use</a></li>
31<li><a href="package-tree.html">Tree</a></li>
32<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
33<li><a href="../../../../index-all.html">Index</a></li>
34<li><a href="../../../../help-doc.html">Help</a></li>
35</ul>
36</div>
37<div class="subNav">
38<ul class="navList">
39<li><a href="../../../../com/fasterxml/jackson/annotation/JsonFilter.html" title="annotation in com.fasterxml.jackson.annotation"><span class="strong">Prev Class</span></a></li>
40<li><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Feature.html" title="enum in com.fasterxml.jackson.annotation"><span class="strong">Next Class</span></a></li>
41</ul>
42<ul class="navList">
43<li><a href="../../../../index.html?com/fasterxml/jackson/annotation/JsonFormat.html" target="_top">Frames</a></li>
44<li><a href="JsonFormat.html" target="_top">No Frames</a></li>
45</ul>
46<ul class="navList" id="allclasses_navbar_top">
47<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
48</ul>
49<div>
50<script type="text/javascript"><!--
51  allClassesLink = document.getElementById("allclasses_navbar_top");
52  if(window==top) {
53    allClassesLink.style.display = "block";
54  }
55  else {
56    allClassesLink.style.display = "none";
57  }
58  //-->
59</script>
60</div>
61<div>
62<ul class="subNavList">
63<li>Summary:&nbsp;</li>
64<li>Required&nbsp;|&nbsp;</li>
65<li><a href="#annotation_type_optional_element_summary">Optional</a></li>
66</ul>
67<ul class="subNavList">
68<li>Detail:&nbsp;</li>
69<li><a href="#annotation_type_element_detail">Element</a></li>
70</ul>
71</div>
72<a name="skip-navbar_top">
73<!--   -->
74</a></div>
75<!-- ========= END OF TOP NAVBAR ========= -->
76<!-- ======== START OF CLASS DATA ======== -->
77<div class="header">
78<div class="subTitle">com.fasterxml.jackson.annotation</div>
79<h2 title="Annotation Type JsonFormat" class="title">Annotation Type JsonFormat</h2>
80</div>
81<div class="contentContainer">
82<div class="description">
83<ul class="blockList">
84<li class="blockList">
85<hr>
86<br>
87<pre><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/annotation/Target.html?is-external=true" title="class or interface in java.lang.annotation">@Target</a>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/annotation/Target.html?is-external=true#value()" title="class or interface in java.lang.annotation">value</a>={<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/annotation/ElementType.html?is-external=true#ANNOTATION_TYPE" title="class or interface in java.lang.annotation">ANNOTATION_TYPE</a>,<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/annotation/ElementType.html?is-external=true#FIELD" title="class or interface in java.lang.annotation">FIELD</a>,<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/annotation/ElementType.html?is-external=true#METHOD" title="class or interface in java.lang.annotation">METHOD</a>,<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/annotation/ElementType.html?is-external=true#PARAMETER" title="class or interface in java.lang.annotation">PARAMETER</a>,<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/annotation/ElementType.html?is-external=true#TYPE" title="class or interface in java.lang.annotation">TYPE</a>})
88<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/annotation/Retention.html?is-external=true" title="class or interface in java.lang.annotation">@Retention</a>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/annotation/Retention.html?is-external=true#value()" title="class or interface in java.lang.annotation">value</a>=<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/annotation/RetentionPolicy.html?is-external=true#RUNTIME" title="class or interface in java.lang.annotation">RUNTIME</a>)
89public @interface <span class="strong">JsonFormat</span></pre>
90<div class="block">General-purpose annotation used for configuring details of how
91 values of properties are to be serialized.
92 Unlike most other Jackson annotations, annotation does not
93 have specific universal interpretation: instead, effect depends on datatype
94 of property being annotated (or more specifically, deserializer
95 and serializer being used).
96<p>
97 Common uses include choosing between alternate representations -- for example,
98 whether <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Date.html?is-external=true" title="class or interface in java.util"><code>Date</code></a> is to be serialized as number (Java timestamp)
99 or String (such as ISO-8601 compatible time value) -- as well as configuring
100 exact details with <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#pattern()"><code>pattern()</code></a> property.
101<p>
102 As of Jackson 2.6, known special handling includes:
103<ul>
104 <li><a href="http://docs.oracle.com/javase/6/docs/api/java/util/Date.html?is-external=true" title="class or interface in java.util"><code>Date</code></a>: Shape can  be <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Shape.html#STRING"><code>JsonFormat.Shape.STRING</code></a> or <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Shape.html#NUMBER"><code>JsonFormat.Shape.NUMBER</code></a>;
105    pattern may contain <a href="http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html?is-external=true" title="class or interface in java.text"><code>SimpleDateFormat</code></a>-compatible pattern definition.
106   </li>
107 <li>Can be used on Classes (types) as well, for modified default behavior, possibly
108   overridden by per-property annotation
109   </li>
110 <li><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang"><code>Enum</code></a>s: Shapes <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Shape.html#STRING"><code>JsonFormat.Shape.STRING</code></a> and <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Shape.html#NUMBER"><code>JsonFormat.Shape.NUMBER</code></a> can be
111    used to change between numeric (index) and textual (name or <code>toString()</code>);
112    but it is also possible to use <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Shape.html#OBJECT"><code>JsonFormat.Shape.OBJECT</code></a> to serialize (but not deserialize)
113    <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang"><code>Enum</code></a>s as JSON Objects (as if they were POJOs). NOTE: serialization
114     as JSON Object only works with class annotation;
115    will not work as per-property annotation.
116   </li>
117 <li><a href="http://docs.oracle.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util"><code>Collection</code></a>s can be serialized as (and deserialized from) JSON Objects,
118    if <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Shape.html#OBJECT"><code>JsonFormat.Shape.OBJECT</code></a> is used. NOTE: can ONLY be used as class annotation;
119    will not work as per-property annotation.
120   </li>
121 <li><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang"><code>Number</code></a> subclasses can be serialized as full objects if
122    <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Shape.html#OBJECT"><code>JsonFormat.Shape.OBJECT</code></a> is used. Otherwise the default behavior of serializing to a
123    scalar number value will be preferred. NOTE: can ONLY be used as class annotation;
124    will not work as per-property annotation.
125   </li>
126</ul></div>
127<dl><dt><span class="strong">Since:</span></dt>
128  <dd>2.0</dd></dl>
129</li>
130</ul>
131</div>
132<div class="summary">
133<ul class="blockList">
134<li class="blockList">
135<!-- =========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY =========== -->
136<ul class="blockList">
137<li class="blockList"><a name="annotation_type_optional_element_summary">
138<!--   -->
139</a>
140<h3>Optional Element Summary</h3>
141<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Optional Element Summary table, listing optional elements, and an explanation">
142<caption><span>Optional Elements</span><span class="tabEnd">&nbsp;</span></caption>
143<tr>
144<th class="colFirst" scope="col">Modifier and Type</th>
145<th class="colLast" scope="col">Optional Element and Description</th>
146</tr>
147<tr class="altColor">
148<td class="colFirst"><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
149<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#locale()">locale</a></strong></code>
150<div class="block"><a href="http://docs.oracle.com/javase/6/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util"><code>Locale</code></a> to use for serialization (if needed).</div>
151</td>
152</tr>
153<tr class="rowColor">
154<td class="colFirst"><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
155<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#pattern()">pattern</a></strong></code>
156<div class="block">Datatype-specific additional piece of configuration that may be used
157 to further refine formatting aspects.</div>
158</td>
159</tr>
160<tr class="altColor">
161<td class="colFirst"><code><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Shape.html" title="enum in com.fasterxml.jackson.annotation">JsonFormat.Shape</a></code></td>
162<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#shape()">shape</a></strong></code>
163<div class="block">Structure to use for serialization: definition of mapping depends on datatype,
164 but usually has straight-forward counterpart in data format (JSON).</div>
165</td>
166</tr>
167<tr class="rowColor">
168<td class="colFirst"><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
169<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#timezone()">timezone</a></strong></code>
170<div class="block"><a href="http://docs.oracle.com/javase/6/docs/api/java/util/TimeZone.html?is-external=true" title="class or interface in java.util"><code>TimeZone</code></a> to use for serialization (if needed).</div>
171</td>
172</tr>
173<tr class="altColor">
174<td class="colFirst"><code><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Feature.html" title="enum in com.fasterxml.jackson.annotation">JsonFormat.Feature</a>[]</code></td>
175<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#with()">with</a></strong></code>
176<div class="block">Set of <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Feature.html" title="enum in com.fasterxml.jackson.annotation"><code>JsonFormat.Feature</code></a>s to explicitly enable with respect
177 to handling of annotated property.</div>
178</td>
179</tr>
180<tr class="rowColor">
181<td class="colFirst"><code><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Feature.html" title="enum in com.fasterxml.jackson.annotation">JsonFormat.Feature</a>[]</code></td>
182<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#without()">without</a></strong></code>
183<div class="block">Set of <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Feature.html" title="enum in com.fasterxml.jackson.annotation"><code>JsonFormat.Feature</code></a>s to explicitly disable with respect
184 to handling of annotated property.</div>
185</td>
186</tr>
187</table>
188</li>
189</ul>
190</li>
191</ul>
192</div>
193<div class="details">
194<ul class="blockList">
195<li class="blockList">
196<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->
197<ul class="blockList">
198<li class="blockList"><a name="annotation_type_element_detail">
199<!--   -->
200</a>
201<h3>Element Detail</h3>
202<a name="pattern()">
203<!--   -->
204</a>
205<ul class="blockList">
206<li class="blockList">
207<h4>pattern</h4>
208<pre>public abstract&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;pattern</pre>
209<div class="block">Datatype-specific additional piece of configuration that may be used
210 to further refine formatting aspects. This may, for example, determine
211 low-level format String used for <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Date.html?is-external=true" title="class or interface in java.util"><code>Date</code></a> serialization;
212 however, exact use is determined by specific <code>JsonSerializer</code></div>
213<dl>
214<dt>Default:</dt>
215<dd>""</dd>
216</dl>
217</li>
218</ul>
219<a name="shape()">
220<!--   -->
221</a>
222<ul class="blockList">
223<li class="blockList">
224<h4>shape</h4>
225<pre>public abstract&nbsp;<a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Shape.html" title="enum in com.fasterxml.jackson.annotation">JsonFormat.Shape</a>&nbsp;shape</pre>
226<div class="block">Structure to use for serialization: definition of mapping depends on datatype,
227 but usually has straight-forward counterpart in data format (JSON).
228 Note that commonly only a subset of shapes is available; and if 'invalid' value
229 is chosen, defaults are usually used.</div>
230<dl>
231<dt>Default:</dt>
232<dd>com.fasterxml.jackson.annotation.JsonFormat.Shape.ANY</dd>
233</dl>
234</li>
235</ul>
236<a name="locale()">
237<!--   -->
238</a>
239<ul class="blockList">
240<li class="blockList">
241<h4>locale</h4>
242<pre>public abstract&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;locale</pre>
243<div class="block"><a href="http://docs.oracle.com/javase/6/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util"><code>Locale</code></a> to use for serialization (if needed).
244 Special value of <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#DEFAULT_LOCALE"><code>DEFAULT_LOCALE</code></a>
245 can be used to mean "just use the default", where default is specified
246 by the serialization context, which in turn defaults to system
247 defaults (<a href="http://docs.oracle.com/javase/6/docs/api/java/util/Locale.html?is-external=true#getDefault()" title="class or interface in java.util"><code>Locale.getDefault()</code></a>) unless explicitly
248 set to another locale.</div>
249<dl>
250<dt>Default:</dt>
251<dd>"##default"</dd>
252</dl>
253</li>
254</ul>
255<a name="timezone()">
256<!--   -->
257</a>
258<ul class="blockList">
259<li class="blockList">
260<h4>timezone</h4>
261<pre>public abstract&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;timezone</pre>
262<div class="block"><a href="http://docs.oracle.com/javase/6/docs/api/java/util/TimeZone.html?is-external=true" title="class or interface in java.util"><code>TimeZone</code></a> to use for serialization (if needed).
263 Special value of <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#DEFAULT_TIMEZONE"><code>DEFAULT_TIMEZONE</code></a>
264 can be used to mean "just use the default", where default is specified
265 by the serialization context, which in turn defaults to system
266 defaults (<a href="http://docs.oracle.com/javase/6/docs/api/java/util/TimeZone.html?is-external=true#getDefault()" title="class or interface in java.util"><code>TimeZone.getDefault()</code></a>) unless explicitly
267 set to another locale.</div>
268<dl>
269<dt>Default:</dt>
270<dd>"##default"</dd>
271</dl>
272</li>
273</ul>
274<a name="with()">
275<!--   -->
276</a>
277<ul class="blockList">
278<li class="blockList">
279<h4>with</h4>
280<pre>public abstract&nbsp;<a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Feature.html" title="enum in com.fasterxml.jackson.annotation">JsonFormat.Feature</a>[]&nbsp;with</pre>
281<div class="block">Set of <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Feature.html" title="enum in com.fasterxml.jackson.annotation"><code>JsonFormat.Feature</code></a>s to explicitly enable with respect
282 to handling of annotated property. This will have precedence over possible
283 global configuration.</div>
284<dl><dt><span class="strong">Since:</span></dt>
285  <dd>2.6</dd></dl>
286<dl>
287<dt>Default:</dt>
288<dd>{}</dd>
289</dl>
290</li>
291</ul>
292<a name="without()">
293<!--   -->
294</a>
295<ul class="blockListLast">
296<li class="blockList">
297<h4>without</h4>
298<pre>public abstract&nbsp;<a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Feature.html" title="enum in com.fasterxml.jackson.annotation">JsonFormat.Feature</a>[]&nbsp;without</pre>
299<div class="block">Set of <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Feature.html" title="enum in com.fasterxml.jackson.annotation"><code>JsonFormat.Feature</code></a>s to explicitly disable with respect
300 to handling of annotated property. This will have precedence over possible
301 global configuration.</div>
302<dl><dt><span class="strong">Since:</span></dt>
303  <dd>2.6</dd></dl>
304<dl>
305<dt>Default:</dt>
306<dd>{}</dd>
307</dl>
308</li>
309</ul>
310</li>
311</ul>
312</li>
313</ul>
314</div>
315</div>
316<!-- ========= END OF CLASS DATA ========= -->
317<!-- ======= START OF BOTTOM NAVBAR ====== -->
318<div class="bottomNav"><a name="navbar_bottom">
319<!--   -->
320</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
321<!--   -->
322</a>
323<ul class="navList" title="Navigation">
324<li><a href="../../../../com/fasterxml/jackson/annotation/package-summary.html">Package</a></li>
325<li class="navBarCell1Rev">Class</li>
326<li><a href="class-use/JsonFormat.html">Use</a></li>
327<li><a href="package-tree.html">Tree</a></li>
328<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
329<li><a href="../../../../index-all.html">Index</a></li>
330<li><a href="../../../../help-doc.html">Help</a></li>
331</ul>
332</div>
333<div class="subNav">
334<ul class="navList">
335<li><a href="../../../../com/fasterxml/jackson/annotation/JsonFilter.html" title="annotation in com.fasterxml.jackson.annotation"><span class="strong">Prev Class</span></a></li>
336<li><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.Feature.html" title="enum in com.fasterxml.jackson.annotation"><span class="strong">Next Class</span></a></li>
337</ul>
338<ul class="navList">
339<li><a href="../../../../index.html?com/fasterxml/jackson/annotation/JsonFormat.html" target="_top">Frames</a></li>
340<li><a href="JsonFormat.html" target="_top">No Frames</a></li>
341</ul>
342<ul class="navList" id="allclasses_navbar_bottom">
343<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
344</ul>
345<div>
346<script type="text/javascript"><!--
347  allClassesLink = document.getElementById("allclasses_navbar_bottom");
348  if(window==top) {
349    allClassesLink.style.display = "block";
350  }
351  else {
352    allClassesLink.style.display = "none";
353  }
354  //-->
355</script>
356</div>
357<div>
358<ul class="subNavList">
359<li>Summary:&nbsp;</li>
360<li>Required&nbsp;|&nbsp;</li>
361<li><a href="#annotation_type_optional_element_summary">Optional</a></li>
362</ul>
363<ul class="subNavList">
364<li>Detail:&nbsp;</li>
365<li><a href="#annotation_type_element_detail">Element</a></li>
366</ul>
367</div>
368<a name="skip-navbar_bottom">
369<!--   -->
370</a></div>
371<!-- ======== END OF BOTTOM NAVBAR ======= -->
372<p class="legalCopy"><small>Copyright &#169; 2014&#x2013;2015 <a href="http://fasterxml.com/">FasterXML</a>. All rights reserved.</small></p>
373</body>
374</html>
375