Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
EclipseLink/Release/2.4.0/JSONBinding
< EclipseLink | Release
Revision as of 12:20, 14 June 2012 by Rick.barkhouse.oracle.com (Talk | contribs)
Object-to-JSON Binding Layer
Overview
New in EclipseLink 2.4 is support for converting objects to and from JSON. This can be useful when creating RESTful services, as JAX-RS services often accept both XML (application/xml) and JSON (application/json) messages.
Same Flexibility as Object-to-XML Mapping
JSON binding is compatible with all existing MOXy extensions. This includes:
- External bindings file
- Dynamic JAXB
- Extensible models
Support both XML and JSON Messages with One Set of Mappings
Both an XML message such as:
<foo xmlns="urn:examle" id="123"> <bar>Hello World</bar> </foo>
and a JSON message such as:
{"foo" : { "id" : 123, "bar : "Hello World" }}
can be supported by a single object model:
@XmlRootElement(namespace="urn:example") public class Foo { @XmlAttribute private int id; @XmlElement(namespace="urn:example") private String bar; }