{"id":10030,"date":"2013-03-19T16:00:24","date_gmt":"2013-03-19T14:00:24","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=10030"},"modified":"2013-03-19T06:46:00","modified_gmt":"2013-03-19T04:46:00","slug":"binding-to-json-xml-handling-collections","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2013\/03\/binding-to-json-xml-handling-collections.html","title":{"rendered":"Binding to JSON &#038; XML &#8211; Handling Collections"},"content":{"rendered":"<p>One of <b><a href=\"http:\/\/www.eclipse.org\/eclipselink\/moxy.php\" target=\"_blank\">EclipseLink JAXB (MOXy)<\/a><\/b>&#8216;s strengths is the ability to map an object model to both JSON and XML with a single set of metadata. The one weakness had been that you needed to compromise on the JSON key or XML element for collection properties. I&#8217;m happy to say that this issue has been solved in EclipseLink 2.5 (and EclipseLink 2.4.2), and I will demonstrate below with an example. You can try this out today by downloading an EclipseLink 2.5.0 (or EclipseLink 2.4.2) nightly build starting on March 15, 2013 from:<\/p>\n<ul>\n<li><a href=\"http:\/\/www.eclipse.org\/eclipselink\/downloads\/nightly.php\">http:\/\/www.eclipse.org\/eclipselink\/downloads\/nightly.php<\/a><\/li>\n<\/ul>\n<p><a name=\"more\"><\/a><\/p>\n<h2>Domain Model <\/h2>\n<p>By default a <a href=\"http:\/\/jcp.org\/en\/jsr\/detail?id=222\" target=\"_blank\">JAXB (JSR-222)<\/a> implementation will not output a grouping element around collection data. This can be done through the use of the <i>@XmlElementWrapper<\/i> annotation (see: J <a href=\"http:\/\/blog.bdoughan.com\/2010\/09\/jaxb-collection-properties.html\">AXB &amp; Collection Properties<\/a><br \/>\n). This grouping element often has a plural name and is a better fit for the key of a JSON array than the repeating element defined by the <i>@XmlElement<\/i> annotation is.<\/p>\n<pre class=\" brush:java\">package blog.json.collections;\r\n\r\nimport java.util.*;\r\nimport javax.xml.bind.annotation.*;\r\n\r\n@XmlRootElement\r\n@XmlType(propOrder={'name', 'emailAddresses'})\r\npublic class Customer {\r\n\r\n    private String name;\r\n    private List&lt;String&gt; emailAddresses = new ArrayList&lt;String&gt;();\r\n\r\n    public String getName() {\r\n        return name;\r\n    }\r\n\r\n    public void setName(String name) {\r\n        this.name = name;\r\n    }\r\n\r\n    @XmlElementWrapper(name='email-addresses')\r\n    @XmlElement(name='email-address')\r\n    public List&lt;String&gt; getEmailAddresses() {\r\n        return emailAddresses;\r\n    }\r\n\r\n    public void setEmailAddresses(List&amp;lt'String&gt; emailAddresses) {\r\n        this.emailAddresses = emailAddresses;\r\n    }\r\n\r\n}<\/pre>\n<h2>Demo<\/h2>\n<p>We will specify the <i>JSON_WRAPPER_AS_ARRAY_NAME<\/i> property with a <i>true<\/i> value to tell MOXy that it should use the grouping element as the name for the JSON array value. Then we will use the same <i>Marshaller<\/i> to output the same object to both XML and JSON.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\" brush:java\">package blog.json.collections;\r\n\r\nimport java.util.*;\r\nimport javax.xml.bind.*;\r\nimport org.eclipse.persistence.jaxb.MarshallerProperties;\r\n\r\npublic class Demo {\r\n\r\n    public static void main(String[] args) throws Exception {\r\n        Customer customer = new Customer();\r\n        customer.setName('Jane Doe');\r\n        customer.getEmailAddresses().add('jane.doe@example.com');\r\n        customer.getEmailAddresses().add('jdoe@example.org');\r\n\r\n        Map&lt;String, Object&gt; properties = new HashMap&lt;String, Object&gt;(1);\r\n        properties.put(MarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true);\r\n        JAXBContext jc = JAXBContext.newInstance(new Class[] {Customer.class}, properties);\r\n\r\n        Marshaller marshaller = jc.createMarshaller();\r\n        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);\r\n\r\n        \/\/ Output XML\r\n        marshaller.marshal(customer, System.out);\r\n\r\n        \/\/ Output JSON\r\n        marshaller.setProperty(MarshallerProperties.MEDIA_TYPE, 'application\/json');\r\n        marshaller.marshal(customer, System.out);\r\n    }\r\n\r\n}<\/pre>\n<h2>XML Output<\/h2>\n<p>Below is the XML output from running the demo code. We see that <i>email-addresses<\/i> is marshalled as the grouping element which contains an <i>email-address<\/i> element for each item in the collection.<\/p>\n<pre class=\" brush:xml\">&lt;?xml version='1.0' encoding='UTF-8'?&gt;\r\n&lt;customer&gt;\r\n   &lt;name&gt;Jane Doe&lt;\/name&gt;\r\n   &lt;email-addresses&gt;\r\n      &lt;email-address&gt;jane.doe@example.com&lt;\/email-address&gt;\r\n      &lt;email-address&gt;jdoe@example.org&lt;\/email-address&gt;\r\n   &lt;\/email-addresses&gt;\r\n&lt;\/customer&gt;<\/pre>\n<h2>JSON Output<\/h2>\n<p>The following JSON output is produced from the same metadata. The only difference is that we told MOXy to use the grouping element as the name for JSON array values.<\/p>\n<pre class=\" brush:java\">{\r\n   'customer' : {\r\n      'name' : 'Jane Doe',\r\n      'email-addresses' : [ 'jane.doe@example.com', 'jdoe@example.org' ]\r\n   }\r\n}<\/pre>\n<h2>JAX-RS <\/h2>\n<p>You can easily use MOXy as your JSON-binding provider in a JAX-RS environment (see: <a href=\"http:\/\/blog.bdoughan.com\/2012\/05\/moxy-as-your-jax-rs-json-provider.html\">MOXy as your JAX-RS JSON Provider &#8211; MOXyJsonProvider<\/a>). You can specify that the grouping element should be used as the JSON array name with the <i>wrapperAsArrayName<\/i> property on <i>MOXyJsonProvider<\/i>.<\/p>\n<pre class=\" brush:java\">package blog.json.collections;\r\n\r\nimport java.util.*;\r\nimport javax.ws.rs.core.Application;\r\nimport org.eclipse.persistence.jaxb.rs.MOXyJsonProvider;\r\n\r\npublic class CustomerApplication  extends Application {\r\n\r\n    @Override\r\n    public Set&lt;Class&lt;?&gt;&gt; getClasses() {\r\n        HashSet&lt;Class&lt;?&gt;&gt; set = new HashSet&lt;Class&lt;?&gt;&gt;(1);\r\n        set.add(CustomerService.class);\r\n        return set;\r\n    }\r\n\r\n    @Override\r\n    public Set&lt;Object&gt; getSingletons() {\r\n        MOXyJsonProvider moxyJsonProvider = new MOXyJsonProvider();\r\n        moxyJsonProvider.setWrapperAsArrayName(true);\r\n\r\n        HashSet&lt;Object&gt; set = new HashSet&lt;Object&gt;(1);\r\n        set.add(moxyJsonProvider);\r\n        return set;\r\n    }\r\n\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p><b><i>Reference: <\/i><\/b><a href=\"http:\/\/blog.bdoughan.com\/2013\/03\/binding-to-json-xml-handling-collections.html\">Binding to JSON &amp; XML &#8211; Handling Collections<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/p\/jcg.html\">JCG partner<\/a> Blaise Doughan at the <a href=\"http:\/\/blog.bdoughan.com\/\">Java XML &amp; JSON Binding<\/a> blog.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of EclipseLink JAXB (MOXy)&#8216;s strengths is the ability to map an object model to both JSON and XML with a single set of metadata. The one weakness had been that you needed to compromise on the JSON key or XML element for collection properties. I&#8217;m happy to say that this issue has been solved &hellip;<\/p>\n","protected":false},"author":51,"featured_media":109,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[144,69,107],"class_list":["post-10030","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-jaxb","tag-json","tag-xml"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Binding to JSON &amp; XML - Handling Collections<\/title>\n<meta name=\"description\" content=\"One of EclipseLink JAXB (MOXy)&#039;s strengths is the ability to map an object model to both JSON and XML with a single set of metadata. The one weakness had\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2013\/03\/binding-to-json-xml-handling-collections.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Binding to JSON &amp; XML - Handling Collections\" \/>\n<meta property=\"og:description\" content=\"One of EclipseLink JAXB (MOXy)&#039;s strengths is the ability to map an object model to both JSON and XML with a single set of metadata. The one weakness had\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2013\/03\/binding-to-json-xml-handling-collections.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2013-03-19T14:00:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/eclipselink-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Blaise Doughan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@http:\/\/twitter.com\/bdoughan\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Blaise Doughan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/binding-to-json-xml-handling-collections.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/binding-to-json-xml-handling-collections.html\"},\"author\":{\"name\":\"Blaise Doughan\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/aa63986b9b274cb85d2c6ea9d73bfda8\"},\"headline\":\"Binding to JSON &#038; XML &#8211; Handling Collections\",\"datePublished\":\"2013-03-19T14:00:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/binding-to-json-xml-handling-collections.html\"},\"wordCount\":349,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/binding-to-json-xml-handling-collections.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/eclipselink-logo.jpg\",\"keywords\":[\"JAXB\",\"JSON\",\"XML\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/binding-to-json-xml-handling-collections.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/binding-to-json-xml-handling-collections.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/binding-to-json-xml-handling-collections.html\",\"name\":\"Binding to JSON & XML - Handling Collections\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/binding-to-json-xml-handling-collections.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/binding-to-json-xml-handling-collections.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/eclipselink-logo.jpg\",\"datePublished\":\"2013-03-19T14:00:24+00:00\",\"description\":\"One of EclipseLink JAXB (MOXy)'s strengths is the ability to map an object model to both JSON and XML with a single set of metadata. The one weakness had\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/binding-to-json-xml-handling-collections.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/binding-to-json-xml-handling-collections.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/binding-to-json-xml-handling-collections.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/eclipselink-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/eclipselink-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/binding-to-json-xml-handling-collections.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Binding to JSON &#038; XML &#8211; Handling Collections\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/aa63986b9b274cb85d2c6ea9d73bfda8\",\"name\":\"Blaise Doughan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/375230a428542e375a6e404b30a2d5620afc3aadb16e21d1268227def78b3703?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/375230a428542e375a6e404b30a2d5620afc3aadb16e21d1268227def78b3703?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/375230a428542e375a6e404b30a2d5620afc3aadb16e21d1268227def78b3703?s=96&d=mm&r=g\",\"caption\":\"Blaise Doughan\"},\"description\":\"Team lead for the TopLink\\\/EclipseLink JAXB &amp; SDO implementations, and the Oracle representative on those specifications.\",\"sameAs\":[\"http:\\\/\\\/blog.bdoughan.com\\\/\",\"http:\\\/\\\/ca.linkedin.com\\\/in\\\/bdoughan\",\"https:\\\/\\\/x.com\\\/http:\\\/\\\/twitter.com\\\/bdoughan\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/blaise-doughan\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Binding to JSON & XML - Handling Collections","description":"One of EclipseLink JAXB (MOXy)'s strengths is the ability to map an object model to both JSON and XML with a single set of metadata. The one weakness had","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2013\/03\/binding-to-json-xml-handling-collections.html","og_locale":"en_US","og_type":"article","og_title":"Binding to JSON & XML - Handling Collections","og_description":"One of EclipseLink JAXB (MOXy)'s strengths is the ability to map an object model to both JSON and XML with a single set of metadata. The one weakness had","og_url":"https:\/\/www.javacodegeeks.com\/2013\/03\/binding-to-json-xml-handling-collections.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2013-03-19T14:00:24+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/eclipselink-logo.jpg","type":"image\/jpeg"}],"author":"Blaise Doughan","twitter_card":"summary_large_image","twitter_creator":"@http:\/\/twitter.com\/bdoughan","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Blaise Doughan","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2013\/03\/binding-to-json-xml-handling-collections.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/03\/binding-to-json-xml-handling-collections.html"},"author":{"name":"Blaise Doughan","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/aa63986b9b274cb85d2c6ea9d73bfda8"},"headline":"Binding to JSON &#038; XML &#8211; Handling Collections","datePublished":"2013-03-19T14:00:24+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/03\/binding-to-json-xml-handling-collections.html"},"wordCount":349,"commentCount":3,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/03\/binding-to-json-xml-handling-collections.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/eclipselink-logo.jpg","keywords":["JAXB","JSON","XML"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2013\/03\/binding-to-json-xml-handling-collections.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2013\/03\/binding-to-json-xml-handling-collections.html","url":"https:\/\/www.javacodegeeks.com\/2013\/03\/binding-to-json-xml-handling-collections.html","name":"Binding to JSON & XML - Handling Collections","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/03\/binding-to-json-xml-handling-collections.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/03\/binding-to-json-xml-handling-collections.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/eclipselink-logo.jpg","datePublished":"2013-03-19T14:00:24+00:00","description":"One of EclipseLink JAXB (MOXy)'s strengths is the ability to map an object model to both JSON and XML with a single set of metadata. The one weakness had","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/03\/binding-to-json-xml-handling-collections.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2013\/03\/binding-to-json-xml-handling-collections.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2013\/03\/binding-to-json-xml-handling-collections.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/eclipselink-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/eclipselink-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2013\/03\/binding-to-json-xml-handling-collections.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Binding to JSON &#038; XML &#8211; Handling Collections"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/aa63986b9b274cb85d2c6ea9d73bfda8","name":"Blaise Doughan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/375230a428542e375a6e404b30a2d5620afc3aadb16e21d1268227def78b3703?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/375230a428542e375a6e404b30a2d5620afc3aadb16e21d1268227def78b3703?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/375230a428542e375a6e404b30a2d5620afc3aadb16e21d1268227def78b3703?s=96&d=mm&r=g","caption":"Blaise Doughan"},"description":"Team lead for the TopLink\/EclipseLink JAXB &amp; SDO implementations, and the Oracle representative on those specifications.","sameAs":["http:\/\/blog.bdoughan.com\/","http:\/\/ca.linkedin.com\/in\/bdoughan","https:\/\/x.com\/http:\/\/twitter.com\/bdoughan"],"url":"https:\/\/www.javacodegeeks.com\/author\/blaise-doughan"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/10030","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/51"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=10030"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/10030\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/109"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=10030"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=10030"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=10030"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}