Hi
On 16/05/12 02:19, jsicotte wrote:
I am seeing an issue where if I have a method that returns a POJO (for
example User):

     @GET
     @Produces("application/json")
     public User getUser(....

The JSON returned will be of the format:

     { "firstName":"foo","lastName":"bar"}

However, if I change the method to return an instance of Response instead:

     return Response.ok().entity(user).build()

The JSON appears to be in what I think is the "badgerfish" format:

    { "user" : { "firstName":"foo","lastName":"bar"} }


Interesting...

Is there a way to make this format match the JSON from my first example? I
have already tried configuring the JAXB provider:

    <bean id="jaxbProvider"
class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
       <property name="convention" value="mapped"/>
    </bean>


How does the User class look like ?

Cheers, Sergey

Any thoughts?

--
View this message in context: 
http://cxf.547215.n5.nabble.com/Using-Response-entity-returns-different-JSON-tp5707943.html
Sent from the cxf-user mailing list archive at Nabble.com.


--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to