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" <adrian.mitev@...>
To: resteasy-developers@...
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
Resteasy-developers@...
https://lists.sourceforge.net/lists/listinfo/resteasy-developers

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"
}
}

Man,
I upgraded maven-compiler-plugin from 2.3.1 to 3.1. 25% build time
improvement. Also, a lot less memory is being used by maven....Wish I
knew that a long time ago.
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com