|
From: Gregor J. <gr...@ja...> - 2013-08-23 13:11:28
|
Hey Adrian,
if you cannot/don't want to change it in the GET method directly but want to deal with it at server side I would tunnel it..
Make a second Rest method, which calls your GET method via client api, then change what you need to change and return the modified version to your client.
If your application is not a high performance app, this approach is a good, clean choice..
- Gregor
----- Original Message -----
From: "Adrian Mitev" <adr...@gm...>
To: res...@li...
Sent: Friday, August 23, 2013 2:02:41 PM
Subject: [Resteasy-developers] Converting object fields when serializing to JSON
Hi all! I'm using the resteasy that comes with jboss 7.2 (EAP 6 alpha). I have a @GET method that produces application/json where i return an object (JPA entity) which contains a String field with the username of the user who created the object. However on the client i need to provide more information - username and full name. Is there a way to configure some kind of converter so from:
class MyClass {
String title;
String username;
}
i should produce:
{
"title" : "something",
"username" : "amitev"
"fullname" : "Adrian Mitev"
}
or
{
"title" : "something",
"user" : {
"username" : "amitev"
"fullname" : "Adrian Mitev"
}
}
------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Resteasy-developers mailing list
Res...@li...
https://lists.sourceforge.net/lists/listinfo/resteasy-developers
|