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 (1.8.0_162) on Sat Apr 25 16:37:31 PDT 2020 -->
6<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7<title>JsonUnwrapped (Jackson-annotations 2.11.0 API)</title>
8<meta name="date" content="2020-04-25">
9<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
10<script type="text/javascript" src="../../../../script.js"></script>
11</head>
12<body>
13<script type="text/javascript"><!--
14    try {
15        if (location.href.indexOf('is-external=true') == -1) {
16            parent.document.title="JsonUnwrapped (Jackson-annotations 2.11.0 API)";
17        }
18    }
19    catch(err) {
20    }
21//-->
22</script>
23<noscript>
24<div>JavaScript is disabled on your browser.</div>
25</noscript>
26<!-- ========= START OF TOP NAVBAR ======= -->
27<div class="topNav"><a name="navbar.top">
28<!--   -->
29</a>
30<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
31<a name="navbar.top.firstrow">
32<!--   -->
33</a>
34<ul class="navList" title="Navigation">
35<li><a href="../../../../com/fasterxml/jackson/annotation/package-summary.html">Package</a></li>
36<li class="navBarCell1Rev">Class</li>
37<li><a href="class-use/JsonUnwrapped.html">Use</a></li>
38<li><a href="package-tree.html">Tree</a></li>
39<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
40<li><a href="../../../../index-all.html">Index</a></li>
41<li><a href="../../../../help-doc.html">Help</a></li>
42</ul>
43</div>
44<div class="subNav">
45<ul class="navList">
46<li><a href="../../../../com/fasterxml/jackson/annotation/JsonTypeName.html" title="annotation in com.fasterxml.jackson.annotation"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
47<li><a href="../../../../com/fasterxml/jackson/annotation/JsonValue.html" title="annotation in com.fasterxml.jackson.annotation"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
48</ul>
49<ul class="navList">
50<li><a href="../../../../index.html?com/fasterxml/jackson/annotation/JsonUnwrapped.html" target="_top">Frames</a></li>
51<li><a href="JsonUnwrapped.html" target="_top">No&nbsp;Frames</a></li>
52</ul>
53<ul class="navList" id="allclasses_navbar_top">
54<li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
55</ul>
56<div>
57<script type="text/javascript"><!--
58  allClassesLink = document.getElementById("allclasses_navbar_top");
59  if(window==top) {
60    allClassesLink.style.display = "block";
61  }
62  else {
63    allClassesLink.style.display = "none";
64  }
65  //-->
66</script>
67</div>
68<div>
69<ul class="subNavList">
70<li>Summary:&nbsp;</li>
71<li>Field&nbsp;|&nbsp;</li>
72<li>Required&nbsp;|&nbsp;</li>
73<li><a href="#annotation.type.optional.element.summary">Optional</a></li>
74</ul>
75<ul class="subNavList">
76<li>Detail:&nbsp;</li>
77<li>Field&nbsp;|&nbsp;</li>
78<li><a href="#annotation.type.element.detail">Element</a></li>
79</ul>
80</div>
81<a name="skip.navbar.top">
82<!--   -->
83</a></div>
84<!-- ========= END OF TOP NAVBAR ========= -->
85<!-- ======== START OF CLASS DATA ======== -->
86<div class="header">
87<div class="subTitle">com.fasterxml.jackson.annotation</div>
88<h2 title="Annotation Type JsonUnwrapped" class="title">Annotation Type JsonUnwrapped</h2>
89</div>
90<div class="contentContainer">
91<div class="description">
92<ul class="blockList">
93<li class="blockList">
94<hr>
95<br>
96<pre><a href="https://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="https://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="https://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="https://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="https://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="https://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>})
97 <a href="https://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="https://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="https://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>)
98public @interface <span class="memberNameLabel">JsonUnwrapped</span></pre>
99<div class="block">Annotation used to indicate that a property should be serialized
100 "unwrapped"; that is, if it would be serialized as JSON Object, its
101 properties are instead included as properties of its containing
102 Object. For example, consider case of POJO like:
103
104<pre>
105  public class Parent {
106    public int age;
107    public Name name;
108  }
109  public class Name {
110    public String first, last;
111  }
112</pre>
113 which would normally be serialized as follows (assuming @JsonUnwrapped
114 had no effect):
115<pre>
116  {
117    "age" : 18,
118    "name" : {
119      "first" : "Joey",
120      "last" : "Sixpack"
121    }
122  }
123</pre>
124 can be changed to this:
125<pre>
126  {
127    "age" : 18,
128    "first" : "Joey",
129    "last" : "Sixpack"
130  }
131</pre>
132 by changing Parent class to:
133<pre>
134  public class Parent {
135    public int age;
136    &#064;JsonUnwrapped
137    public Name name;
138  }
139</pre>
140 Annotation can only be added to properties, and not classes, as it is contextual.
141<p>
142 Also note that annotation only applies if
143<ul>
144 <li>Value is serialized as JSON Object (can not unwrap JSON arrays using this
145   mechanism)
146   </li>
147 <li>Serialization is done using <code>BeanSerializer</code>, not a custom serializer
148   </li>
149 <li>No type information is added; if type information needs to be added, structure can
150   not be altered regardless of inclusion strategy; so annotation is basically ignored.
151   </li>
152 </ul></div>
153</li>
154</ul>
155</div>
156<div class="summary">
157<ul class="blockList">
158<li class="blockList">
159<!-- =========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY =========== -->
160<ul class="blockList">
161<li class="blockList"><a name="annotation.type.optional.element.summary">
162<!--   -->
163</a>
164<h3>Optional Element Summary</h3>
165<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Optional Element Summary table, listing optional elements, and an explanation">
166<caption><span>Optional Elements</span><span class="tabEnd">&nbsp;</span></caption>
167<tr>
168<th class="colFirst" scope="col">Modifier and Type</th>
169<th class="colLast" scope="col">Optional Element and Description</th>
170</tr>
171<tr class="altColor">
172<td class="colFirst"><code>boolean</code></td>
173<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/fasterxml/jackson/annotation/JsonUnwrapped.html#enabled--">enabled</a></span></code>
174<div class="block">Property that is usually only used when overriding (masking) annotations,
175 using mix-in annotations.</div>
176</td>
177</tr>
178<tr class="rowColor">
179<td class="colFirst"><code><a href="https://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>
180<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/fasterxml/jackson/annotation/JsonUnwrapped.html#prefix--">prefix</a></span></code>
181<div class="block">Optional property that can be used to add prefix String to use in front
182 of names of properties that are unwrapped: this can be done for example to prevent
183 name collisions.</div>
184</td>
185</tr>
186<tr class="altColor">
187<td class="colFirst"><code><a href="https://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>
188<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/fasterxml/jackson/annotation/JsonUnwrapped.html#suffix--">suffix</a></span></code>
189<div class="block">Optional property that can be used to add suffix String to append at the end
190 of names of properties that are unwrapped: this can be done for example to prevent
191 name collisions.</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="enabled--">
210<!--   -->
211</a>
212<ul class="blockList">
213<li class="blockList">
214<h4>enabled</h4>
215<pre>public abstract&nbsp;boolean&nbsp;enabled</pre>
216<div class="block">Property that is usually only used when overriding (masking) annotations,
217 using mix-in annotations. Otherwise default value of 'true' is fine, and
218 value need not be explicitly included.</div>
219<dl>
220<dt>Default:</dt>
221<dd>true</dd>
222</dl>
223</li>
224</ul>
225</li>
226</ul>
227<ul class="blockList">
228<li class="blockList"><a name="prefix--">
229<!--   -->
230</a>
231<ul class="blockList">
232<li class="blockList">
233<h4>prefix</h4>
234<pre>public abstract&nbsp;<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;prefix</pre>
235<div class="block">Optional property that can be used to add prefix String to use in front
236 of names of properties that are unwrapped: this can be done for example to prevent
237 name collisions.</div>
238<dl>
239<dt>Default:</dt>
240<dd>""</dd>
241</dl>
242</li>
243</ul>
244</li>
245</ul>
246<ul class="blockList">
247<li class="blockList"><a name="suffix--">
248<!--   -->
249</a>
250<ul class="blockListLast">
251<li class="blockList">
252<h4>suffix</h4>
253<pre>public abstract&nbsp;<a href="https://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;suffix</pre>
254<div class="block">Optional property that can be used to add suffix String to append at the end
255 of names of properties that are unwrapped: this can be done for example to prevent
256 name collisions.</div>
257<dl>
258<dt>Default:</dt>
259<dd>""</dd>
260</dl>
261</li>
262</ul>
263</li>
264</ul>
265</li>
266</ul>
267</div>
268</div>
269<!-- ========= END OF CLASS DATA ========= -->
270<!-- ======= START OF BOTTOM NAVBAR ====== -->
271<div class="bottomNav"><a name="navbar.bottom">
272<!--   -->
273</a>
274<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
275<a name="navbar.bottom.firstrow">
276<!--   -->
277</a>
278<ul class="navList" title="Navigation">
279<li><a href="../../../../com/fasterxml/jackson/annotation/package-summary.html">Package</a></li>
280<li class="navBarCell1Rev">Class</li>
281<li><a href="class-use/JsonUnwrapped.html">Use</a></li>
282<li><a href="package-tree.html">Tree</a></li>
283<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
284<li><a href="../../../../index-all.html">Index</a></li>
285<li><a href="../../../../help-doc.html">Help</a></li>
286</ul>
287</div>
288<div class="subNav">
289<ul class="navList">
290<li><a href="../../../../com/fasterxml/jackson/annotation/JsonTypeName.html" title="annotation in com.fasterxml.jackson.annotation"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
291<li><a href="../../../../com/fasterxml/jackson/annotation/JsonValue.html" title="annotation in com.fasterxml.jackson.annotation"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
292</ul>
293<ul class="navList">
294<li><a href="../../../../index.html?com/fasterxml/jackson/annotation/JsonUnwrapped.html" target="_top">Frames</a></li>
295<li><a href="JsonUnwrapped.html" target="_top">No&nbsp;Frames</a></li>
296</ul>
297<ul class="navList" id="allclasses_navbar_bottom">
298<li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
299</ul>
300<div>
301<script type="text/javascript"><!--
302  allClassesLink = document.getElementById("allclasses_navbar_bottom");
303  if(window==top) {
304    allClassesLink.style.display = "block";
305  }
306  else {
307    allClassesLink.style.display = "none";
308  }
309  //-->
310</script>
311</div>
312<div>
313<ul class="subNavList">
314<li>Summary:&nbsp;</li>
315<li>Field&nbsp;|&nbsp;</li>
316<li>Required&nbsp;|&nbsp;</li>
317<li><a href="#annotation.type.optional.element.summary">Optional</a></li>
318</ul>
319<ul class="subNavList">
320<li>Detail:&nbsp;</li>
321<li>Field&nbsp;|&nbsp;</li>
322<li><a href="#annotation.type.element.detail">Element</a></li>
323</ul>
324</div>
325<a name="skip.navbar.bottom">
326<!--   -->
327</a></div>
328<!-- ======== END OF BOTTOM NAVBAR ======= -->
329<p class="legalCopy"><small>Copyright &#169; 2008&#x2013;2020 <a href="http://fasterxml.com/">FasterXML</a>. All rights reserved.</small></p>
330</body>
331</html>
332