• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_79) on Tue Jan 23 20:10:06 PST 2018 -->
6<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7<title>JsonFormat (Jackson-annotations 2.9.0 API)</title>
8<meta name="date" content="2018-01-23">
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.9.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="../../../../com/fasterxml/jackson/annotation/OptBoolean.html" title="enum in com.fasterxml.jackson.annotation">OptBoolean</a></code></td>
149<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#lenient()">lenient</a></strong></code>
150<div class="block">Property that indicates whether "lenient" handling should be enabled or
151 disabled.</div>
152</td>
153</tr>
154<tr class="rowColor">
155<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>
156<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#locale()">locale</a></strong></code>
157<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>
158</td>
159</tr>
160<tr class="altColor">
161<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>
162<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#pattern()">pattern</a></strong></code>
163<div class="block">Datatype-specific additional piece of configuration that may be used
164 to further refine formatting aspects.</div>
165</td>
166</tr>
167<tr class="rowColor">
168<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>
169<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#shape()">shape</a></strong></code>
170<div class="block">Structure to use for serialization: definition of mapping depends on datatype,
171 but usually has straight-forward counterpart in data format (JSON).</div>
172</td>
173</tr>
174<tr class="altColor">
175<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>
176<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#timezone()">timezone</a></strong></code>
177<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>
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#with()">with</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 enable with respect
184 to handling of annotated property.</div>
185</td>
186</tr>
187<tr class="altColor">
188<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>
189<td class="colLast"><code><strong><a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#without()">without</a></strong></code>
190<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
191 to handling of annotated property.</div>
192</td>
193</tr>
194</table>
195</li>
196</ul>
197</li>
198</ul>
199</div>
200<div class="details">
201<ul class="blockList">
202<li class="blockList">
203<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->
204<ul class="blockList">
205<li class="blockList"><a name="annotation_type_element_detail">
206<!--   -->
207</a>
208<h3>Element Detail</h3>
209<a name="pattern()">
210<!--   -->
211</a>
212<ul class="blockList">
213<li class="blockList">
214<h4>pattern</h4>
215<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>
216<div class="block">Datatype-specific additional piece of configuration that may be used
217 to further refine formatting aspects. This may, for example, determine
218 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;
219 however, exact use is determined by specific <code>JsonSerializer</code></div>
220<dl>
221<dt>Default:</dt>
222<dd>""</dd>
223</dl>
224</li>
225</ul>
226<a name="shape()">
227<!--   -->
228</a>
229<ul class="blockList">
230<li class="blockList">
231<h4>shape</h4>
232<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>
233<div class="block">Structure to use for serialization: definition of mapping depends on datatype,
234 but usually has straight-forward counterpart in data format (JSON).
235 Note that commonly only a subset of shapes is available; and if 'invalid' value
236 is chosen, defaults are usually used.</div>
237<dl>
238<dt>Default:</dt>
239<dd>com.fasterxml.jackson.annotation.JsonFormat.Shape.ANY</dd>
240</dl>
241</li>
242</ul>
243<a name="locale()">
244<!--   -->
245</a>
246<ul class="blockList">
247<li class="blockList">
248<h4>locale</h4>
249<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>
250<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).
251 Special value of <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#DEFAULT_LOCALE"><code>DEFAULT_LOCALE</code></a>
252 can be used to mean "just use the default", where default is specified
253 by the serialization context, which in turn defaults to system
254 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
255 set to another locale.</div>
256<dl>
257<dt>Default:</dt>
258<dd>"##default"</dd>
259</dl>
260</li>
261</ul>
262<a name="timezone()">
263<!--   -->
264</a>
265<ul class="blockList">
266<li class="blockList">
267<h4>timezone</h4>
268<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>
269<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).
270 Special value of <a href="../../../../com/fasterxml/jackson/annotation/JsonFormat.html#DEFAULT_TIMEZONE"><code>DEFAULT_TIMEZONE</code></a>
271 can be used to mean "just use the default", where default is specified
272 by the serialization context, which in turn defaults to system
273 default (UTC) unless explicitly set to another timezone.</div>
274<dl>
275<dt>Default:</dt>
276<dd>"##default"</dd>
277</dl>
278</li>
279</ul>
280<a name="lenient()">
281<!--   -->
282</a>
283<ul class="blockList">
284<li class="blockList">
285<h4>lenient</h4>
286<pre>public abstract&nbsp;<a href="../../../../com/fasterxml/jackson/annotation/OptBoolean.html" title="enum in com.fasterxml.jackson.annotation">OptBoolean</a>&nbsp;lenient</pre>
287<div class="block">Property that indicates whether "lenient" handling should be enabled or
288 disabled. This is relevant mostly for deserialization of some textual
289 datatypes, especially date/time types.
290<p>
291 Note that underlying default setting depends on datatype (or more precisely
292 deserializer for it): for most date/time types, default is for leniency
293 to be enabled.</div>
294<dl><dt><span class="strong">Since:</span></dt>
295  <dd>2.9</dd></dl>
296<dl>
297<dt>Default:</dt>
298<dd>com.fasterxml.jackson.annotation.OptBoolean.DEFAULT</dd>
299</dl>
300</li>
301</ul>
302<a name="with()">
303<!--   -->
304</a>
305<ul class="blockList">
306<li class="blockList">
307<h4>with</h4>
308<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>
309<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
310 to handling of annotated property. This will have precedence over possible
311 global configuration.</div>
312<dl><dt><span class="strong">Since:</span></dt>
313  <dd>2.6</dd></dl>
314<dl>
315<dt>Default:</dt>
316<dd>{}</dd>
317</dl>
318</li>
319</ul>
320<a name="without()">
321<!--   -->
322</a>
323<ul class="blockListLast">
324<li class="blockList">
325<h4>without</h4>
326<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>
327<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
328 to handling of annotated property. This will have precedence over possible
329 global configuration.</div>
330<dl><dt><span class="strong">Since:</span></dt>
331  <dd>2.6</dd></dl>
332<dl>
333<dt>Default:</dt>
334<dd>{}</dd>
335</dl>
336</li>
337</ul>
338</li>
339</ul>
340</li>
341</ul>
342</div>
343</div>
344<!-- ========= END OF CLASS DATA ========= -->
345<!-- ======= START OF BOTTOM NAVBAR ====== -->
346<div class="bottomNav"><a name="navbar_bottom">
347<!--   -->
348</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
349<!--   -->
350</a>
351<ul class="navList" title="Navigation">
352<li><a href="../../../../com/fasterxml/jackson/annotation/package-summary.html">Package</a></li>
353<li class="navBarCell1Rev">Class</li>
354<li><a href="class-use/JsonFormat.html">Use</a></li>
355<li><a href="package-tree.html">Tree</a></li>
356<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
357<li><a href="../../../../index-all.html">Index</a></li>
358<li><a href="../../../../help-doc.html">Help</a></li>
359</ul>
360</div>
361<div class="subNav">
362<ul class="navList">
363<li><a href="../../../../com/fasterxml/jackson/annotation/JsonFilter.html" title="annotation in com.fasterxml.jackson.annotation"><span class="strong">Prev Class</span></a></li>
364<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>
365</ul>
366<ul class="navList">
367<li><a href="../../../../index.html?com/fasterxml/jackson/annotation/JsonFormat.html" target="_top">Frames</a></li>
368<li><a href="JsonFormat.html" target="_top">No Frames</a></li>
369</ul>
370<ul class="navList" id="allclasses_navbar_bottom">
371<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
372</ul>
373<div>
374<script type="text/javascript"><!--
375  allClassesLink = document.getElementById("allclasses_navbar_bottom");
376  if(window==top) {
377    allClassesLink.style.display = "block";
378  }
379  else {
380    allClassesLink.style.display = "none";
381  }
382  //-->
383</script>
384</div>
385<div>
386<ul class="subNavList">
387<li>Summary:&nbsp;</li>
388<li>Required&nbsp;|&nbsp;</li>
389<li><a href="#annotation_type_optional_element_summary">Optional</a></li>
390</ul>
391<ul class="subNavList">
392<li>Detail:&nbsp;</li>
393<li><a href="#annotation_type_element_detail">Element</a></li>
394</ul>
395</div>
396<a name="skip-navbar_bottom">
397<!--   -->
398</a></div>
399<!-- ======== END OF BOTTOM NAVBAR ======= -->
400<p class="legalCopy"><small>Copyright &#169; 2008&#x2013;2018 <a href="http://fasterxml.com/">FasterXML</a>. All rights reserved.</small></p>
401</body>
402</html>
403