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:Unmapped Columns in ResultSet
Next Topic:Problem removing directory with database
Goto Forum:
  


Current Time: Wed Jul 26 17:08:27 GMT 2017

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

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