Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Include json.root element as a @type attribute
Include json.root element as a @type attribute [message #1322363] Tue, 29 April 2014 20:36
greg Mising name is currently offline greg Mising nameFriend
Messages: 3
Registered: July 2009
Junior Member
hi,

Is there any way to "tell" moxy to always append class type information when marshaing java object to JSON i.e.
Given
@XmlRootElement
class Customer{
  private String name;
}


I'd like to be marshalled to:
{
  "@type":"customer",
  "name":"greg"
}


I don't want to set "eclipselink.json.include-root" property on my marshaller as it creates hierarchy in the JSON text (see below). Instead of that i'd like it to be replaced with an attribute. The interesting thing is that should my example class extended some arbitrary class e.g. MyDummy.class then the output JSON would include @type node

{ 
  "customer":{
    "@type":"customer",
    "name":"greg"
  }
}


Previous Topic:Custom PoolDataSource - How to change in EclipseLink
Next Topic:Exception when updating object from outside of transaction
Goto Forum:
  


Current Time: Wed Apr 24 15:33:25 GMT 2024

Powered by FUDForum. Page generated in 0.02426 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top