The Java API for JSON Processing (JSR-353) is the Java standard for producing and consuming JSON which was introduced as part of Java EE 7. JSR-353 includes object (DOM like) and stream (StAX like) APIs. In this post I will demonstrate the initial JSR-353 support we have added to MOXy‘s JSON binding in EclipseLink 2.6. You can now use MOXy ...
Read More »Home »
MOXy’s @XmlVariableNode – JSON Schema Example
We are in the process of adding the ability to generate a JSON Schema from your domain model to EclipseLink MOXy. To accomplish this we have created a new Variable Node mapping. In this post I will demonstrate the new mapping by mapping a Java model to a JSON Schema. You can try this out today using a nightly build ...
Read More »MOXy is the New Default JSON-Binding Provider in GlassFish 4
GlassFish 4 is now available offering the complete Java EE 7 (JSR-342) platform. EclipseLink made some major contributions to this release. The first is providing the JPA 2.1 (JSR-338) implementation. The second which I’ll cover in this post is EclipseLink MOXy is now the default JSON-binding provider for JAX-RS applications. RESTful Service CustomerService Normally a real service will be backed ...
Read More »MOXy’s Object Graphs & Dynamic JAXB
JAXB (JSR-222) makes it easy for you to convert instances of your domain classes to/from XML. The EclipseLink MOXy implementation offers an extension called Dynamic JAXB where instead of real classes you have instances of a map like class called DynamicEntity. You can access the data on your DynamicEntity using get and set methods that take the property name (i.e. ...
Read More »Introducing EclipseLink JPA-RS
In a previous series of posts I covered how to create a JAX-RS service that leveraged JPA for the persistence layer. EclipseLink contains a component called JPA-RS that can be used to easily and automatically expose a persistence unit as RESTful service (that supports XML and JSON messages). MOXy provides the XML and JSON-binding for JPA-RS and things like bidirectional ...
Read More »Java API for JSON Processing (JSR-353) – Stream APIs
Java will soon have a standard set of APIs for processing JSON as part of Java EE 7. This standard is being defined as JSR 353 – Java API for JSON Processing (JSON-P) and it is currently at the Final Approval Ballot. JSON-P offers both object oriented and stream based approaches, in this post I will introduce the stream APIs. ...
Read More »MOXy’s Object Graphs – Input/Output Partial Models to XML & JSON
Suppose you have a domain model that you want to expose as a RESTful service. The problem is you only want to input/output part of your data. Previously you would have created a separate model representing the subset and then have code to move data between the models. In EclipseLink 2.5.0 we have a new feature called Object Graphs that ...
Read More »Binding to JSON & XML – Handling Collections
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 been that you needed to compromise on the JSON key or XML element for collection properties. I’m happy to say that this issue has been solved in EclipseLink 2.5 (and EclipseLink ...
Read More »JAXB and java.util.Map
Is it ironic that it can be difficult to map the java.util.Map class in JAXB (JSR-222)? In this post I will cover some items that will make it much easier. Java Model Below is the Java model that we will use for this example. Customer The Customer class has a property of type Map . I chose this Map specifically ...
Read More »