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. 
customer.get("address") and 
customer.set('name", "Jane Doe").
In this post, first we will bootstrap a dynamic 
JAXBContext based on an external mapping file.  Then we unmarshal an XML document to dynamic entities, and finally we will apply an object graph to scope the resulting JSON output.
 
You can try this out today by downloading an EclipseLink 2.5.0 nightly download starting on March 24, 2013 from: