1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<!--NewPage--> 3<HTML> 4<HEAD> 5<!-- Generated by javadoc (build 1.6.0_35) on Fri Oct 05 20:53:30 PDT 2012 --> 6<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> 7<TITLE> 8JsonUnwrapped (Jackson-annotations 2.1.0 API) 9</TITLE> 10 11<META NAME="date" CONTENT="2012-10-05"> 12 13<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> 14 15<SCRIPT type="text/javascript"> 16function windowTitle() 17{ 18 if (location.href.indexOf('is-external=true') == -1) { 19 parent.document.title="JsonUnwrapped (Jackson-annotations 2.1.0 API)"; 20 } 21} 22</SCRIPT> 23<NOSCRIPT> 24</NOSCRIPT> 25 26</HEAD> 27 28<BODY BGCOLOR="white" onload="windowTitle();"> 29<HR> 30 31 32<!-- ========= START OF TOP NAVBAR ======= --> 33<A NAME="navbar_top"><!-- --></A> 34<A HREF="#skip-navbar_top" title="Skip navigation links"></A> 35<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 36<TR> 37<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 38<A NAME="navbar_top_firstrow"><!-- --></A> 39<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 40 <TR ALIGN="center" VALIGN="top"> 41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../com/fasterxml/jackson/annotation/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 42 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 43 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/JsonUnwrapped.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 44 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 45 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 46 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 47 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 48 </TR> 49</TABLE> 50</TD> 51<TD ALIGN="right" VALIGN="top" ROWSPAN=3><script type="text/javascript"><!-- 52google_ad_client = "pub-1467773697956887"; 53/* Jackson-ad-small */ 54google_ad_slot = "6699487946"; 55google_ad_width = 234; 56google_ad_height = 60; 57//--> 58</script> 59<script type="text/javascript" 60src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> 61</script> 62</TD> 63</TR> 64 65<TR> 66<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 67 <A HREF="../../../../com/fasterxml/jackson/annotation/JsonTypeName.html" title="annotation in com.fasterxml.jackson.annotation"><B>PREV CLASS</B></A> 68 <A HREF="../../../../com/fasterxml/jackson/annotation/JsonValue.html" title="annotation in com.fasterxml.jackson.annotation"><B>NEXT CLASS</B></A></FONT></TD> 69<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 70 <A HREF="../../../../index.html?com/fasterxml/jackson/annotation/JsonUnwrapped.html" target="_top"><B>FRAMES</B></A> 71 <A HREF="JsonUnwrapped.html" target="_top"><B>NO FRAMES</B></A> 72 <SCRIPT type="text/javascript"> 73 <!-- 74 if(window==top) { 75 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); 76 } 77 //--> 78</SCRIPT> 79<NOSCRIPT> 80 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> 81</NOSCRIPT> 82 83 84</FONT></TD> 85</TR> 86<TR> 87<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 88 SUMMARY: REQUIRED | <A HREF="#annotation_type_optional_element_summary">OPTIONAL</A></FONT></TD> 89<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 90DETAIL: <A HREF="#annotation_type_element_detail">ELEMENT</A></FONT></TD> 91</TR> 92</TABLE> 93<A NAME="skip-navbar_top"></A> 94<!-- ========= END OF TOP NAVBAR ========= --> 95 96<HR> 97<!-- ======== START OF CLASS DATA ======== --> 98<H2> 99<FONT SIZE="-1"> 100com.fasterxml.jackson.annotation</FONT> 101<BR> 102Annotation Type JsonUnwrapped</H2> 103<HR> 104<DL> 105<DT><PRE><FONT SIZE="-1"><A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/annotation/Target.html?is-external=true" title="class or interface in java.lang.annotation">@Target</A>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/annotation/Target.html?is-external=true#value()" title="class or interface in java.lang.annotation">value</A>={<A HREF="http://download.oracle.com/javase/1.5.0/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://download.oracle.com/javase/1.5.0/docs/api/java/lang/annotation/ElementType.html?is-external=true#FIELD" title="class or interface in java.lang.annotation">FIELD</A>,<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/annotation/ElementType.html?is-external=true#METHOD" title="class or interface in java.lang.annotation">METHOD</A>,<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/annotation/ElementType.html?is-external=true#PARAMETER" title="class or interface in java.lang.annotation">PARAMETER</A>}) 106<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/annotation/Retention.html?is-external=true" title="class or interface in java.lang.annotation">@Retention</A>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/annotation/Retention.html?is-external=true#value()" title="class or interface in java.lang.annotation">value</A>=<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/annotation/RetentionPolicy.html?is-external=true#RUNTIME" title="class or interface in java.lang.annotation">RUNTIME</A>) 107</FONT>public @interface <B>JsonUnwrapped</B></DL> 108</PRE> 109 110<P> 111Annotation used to indicate that a property should be serialized 112 "unwrapped"; that is, if it would be serialized as JSON Object, its 113 properties are instead included as properties of its containing 114 Object. For example, consider case of POJO like: 115 116<pre> 117 public class Parent { 118 public int age; 119 public Name name; 120 } 121 public class Name { 122 public String first, last; 123 } 124</pre> 125 which would normally be serialized as follows (assuming @JsonUnwrapped 126 had no effect): 127<pre> 128 { 129 "age" : 18, 130 "name" : { 131 "first" : "Joey", 132 "last" : "Sixpack" 133 } 134 } 135</pre> 136 can be changed to this: 137<pre> 138 { 139 "age" : 18, 140 "first" : "Joey", 141 "last" : "Sixpack" 142 } 143</pre> 144 by changing Parent class to: 145<pre> 146 public class Parent { 147 public int age; 148 \@JsonUnwrapped 149 public Name name; 150 } 151</pre> 152 Annotation can only be added to properties, and not classes, as it is contextual. 153<p> 154 Also note that annotation only applies if 155<ul> 156 <li>Value is serialized as JSON Object (can not unwrap JSON arrays using this 157 mechanism) 158 </li> 159 <li>Serialization is done using <code>BeanSerializer</code>, not a custom serializer 160 </li> 161 <li>No type information is added; if type information needs to be added, structure can 162 not be altered regardless of inclusion strategy; so annotation is basically ignored. 163 </li> 164 </ul> 165<P> 166 167<P> 168<HR> 169 170<P> 171<!-- =========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY =========== --> 172 173<A NAME="annotation_type_optional_element_summary"><!-- --></A> 174<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 175<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 176<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 177<B>Optional Element Summary</B></FONT></TH> 178</TR> 179<TR BGCOLOR="white" CLASS="TableRowColor"> 180<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 181<CODE> boolean</CODE></FONT></TD> 182<TD><CODE><B><A HREF="../../../../com/fasterxml/jackson/annotation/JsonUnwrapped.html#enabled()">enabled</A></B></CODE> 183 184<BR> 185 Property that is usually only used when overriding (masking) annotations, 186 using mix-in annotations.</TD> 187</TR> 188<TR BGCOLOR="white" CLASS="TableRowColor"> 189<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 190<CODE> <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD> 191<TD><CODE><B><A HREF="../../../../com/fasterxml/jackson/annotation/JsonUnwrapped.html#prefix()">prefix</A></B></CODE> 192 193<BR> 194 Optional property that can be used to add prefix String to use in front 195 of names of properties that are unwrapped: this can be done for example to prevent 196 name collisions.</TD> 197</TR> 198<TR BGCOLOR="white" CLASS="TableRowColor"> 199<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 200<CODE> <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD> 201<TD><CODE><B><A HREF="../../../../com/fasterxml/jackson/annotation/JsonUnwrapped.html#suffix()">suffix</A></B></CODE> 202 203<BR> 204 Optional property that can be used to add suffix String to append at the end 205 of names of properties that are unwrapped: this can be done for example to prevent 206 name collisions.</TD> 207</TR> 208</TABLE> 209 210<P> 211<A NAME="enabled()"><!-- --></A><H3> 212enabled</H3> 213<PRE> 214public abstract boolean <B>enabled</B></PRE> 215<DL> 216<DD>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. 219<P> 220<DD><DL> 221</DL> 222</DD> 223<DD><DL> 224</DL> 225<DL> 226<DT><B>Default:</B><DD>true</DD> 227</DL> 228</DL> 229<HR> 230 231<A NAME="prefix()"><!-- --></A><H3> 232prefix</H3> 233<PRE> 234public abstract <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>prefix</B></PRE> 235<DL> 236<DD>Optional property that can be used to add prefix String to use in front 237 of names of properties that are unwrapped: this can be done for example to prevent 238 name collisions. 239<P> 240<DD><DL> 241</DL> 242</DD> 243<DD><DL> 244</DL> 245<DL> 246<DT><B>Default:</B><DD>""</DD> 247</DL> 248</DL> 249<HR> 250 251<A NAME="suffix()"><!-- --></A><H3> 252suffix</H3> 253<PRE> 254public abstract <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>suffix</B></PRE> 255<DL> 256<DD>Optional property that can be used to add suffix String to append at the end 257 of names of properties that are unwrapped: this can be done for example to prevent 258 name collisions. 259<P> 260<DD><DL> 261</DL> 262</DD> 263<DD><DL> 264</DL> 265<DL> 266<DT><B>Default:</B><DD>""</DD> 267</DL> 268</DL> 269<!-- ========= END OF CLASS DATA ========= --> 270<HR> 271 272 273<!-- ======= START OF BOTTOM NAVBAR ====== --> 274<A NAME="navbar_bottom"><!-- --></A> 275<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> 276<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 277<TR><td rowspan='3'><script type="text/javascript"><!-- 278google_ad_client = "pub-1467773697956887"; 279/* Jackson-ad-small */ 280google_ad_slot = "6699487946"; 281google_ad_width = 234; 282google_ad_height = 60; 283//--> 284</script> 285<script type="text/javascript" 286src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> 287</script> 288<!-- GA --> 289<script type="text/javascript"> 290var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); 291document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); 292</script> 293<script type="text/javascript"> 294try { 295var pageTracker = _gat._getTracker("UA-140287-6"); 296pageTracker._trackPageview(); 297} catch(err) {} 298</script> 299</td> 300<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 301<A NAME="navbar_bottom_firstrow"><!-- --></A> 302<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 303 <TR ALIGN="center" VALIGN="top"> 304 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../com/fasterxml/jackson/annotation/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 305 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 306 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/JsonUnwrapped.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 307 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 308 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 309 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 310 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 311 </TR> 312</TABLE> 313</TD> 314<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 315</EM> 316</TD> 317</TR> 318 319<TR> 320<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 321 <A HREF="../../../../com/fasterxml/jackson/annotation/JsonTypeName.html" title="annotation in com.fasterxml.jackson.annotation"><B>PREV CLASS</B></A> 322 <A HREF="../../../../com/fasterxml/jackson/annotation/JsonValue.html" title="annotation in com.fasterxml.jackson.annotation"><B>NEXT CLASS</B></A></FONT></TD> 323<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 324 <A HREF="../../../../index.html?com/fasterxml/jackson/annotation/JsonUnwrapped.html" target="_top"><B>FRAMES</B></A> 325 <A HREF="JsonUnwrapped.html" target="_top"><B>NO FRAMES</B></A> 326 <SCRIPT type="text/javascript"> 327 <!-- 328 if(window==top) { 329 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); 330 } 331 //--> 332</SCRIPT> 333<NOSCRIPT> 334 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> 335</NOSCRIPT> 336 337 338</FONT></TD> 339</TR> 340<TR> 341<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 342 SUMMARY: REQUIRED | <A HREF="#annotation_type_optional_element_summary">OPTIONAL</A></FONT></TD> 343<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 344DETAIL: <A HREF="#annotation_type_element_detail">ELEMENT</A></FONT></TD> 345</TR> 346</TABLE> 347<A NAME="skip-navbar_bottom"></A> 348<!-- ======== END OF BOTTOM NAVBAR ======= --> 349 350<HR> 351Copyright © 2012 <a href="http://fasterxml.com/">FasterXML</a>. All Rights Reserved. 352</BODY> 353</HTML> 354