well I stopped trying to get what I want with jettison since years.
The usage of jaxb tree to get json is quite broken in several places
so my advice would be to use either johnzon jaxrs provider or jackson.


Romain Manni-Bucau
@rmannibucau
http://www.tomitribe.com
http://rmannibucau.wordpress.com
https://github.com/rmannibucau


2014-10-20 16:44 GMT+02:00 José Luis Cetina <maxtorz...@gmail.com>:
> Thanks, now its working.
>
> But now all of my object's are serialize as array, do i have to map each
> pojo and set the attributes that i need to serializeAsArray ?
>
>
> public class MyObject{
>    int id;  String name;
> }
>
> public MyObject getInfo(){
>    return new MyObject();
> }
>
> Now my json return value es:
>  myObject: [{id:1, name:'any'}]
>
> and i expected to be:
>  myObject: {id:1, name:'any'}
>
>
>
>
>
>
> 2014-10-20 8:38 GMT-05:00 Romain Manni-Bucau <rmannibu...@gmail.com>:
>
>> <openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1"; xmlns:xsi="
>> http://www.w3.org/2001/XMLSchema-instance";
>>              xsi:schemaLocation="http://www.openejb.org/openejb-jar/1.1 ">
>>     <pojo-deployment  class-name="jaxrs-application">
>>          <properties>
>>             cxf.jaxrs.providers = json
>>         </properties>
>>     </pojo-deployment>
>> </openejb-jar>
>>
>>
>> resources.xml
>>
>> <resources>
>>     <Service id="json"
>> class-name="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>>         serializeAsArray = true
>>     </Service>
>> </resources>
>>
>>
>> jackson doesn't have any setter so you have to do your own wrapper to
>> provide the properties you want to configure (or hardcode them)
>>
>>
>>
>>
>> Romain Manni-Bucau
>> @rmannibucau
>> http://www.tomitribe.com
>> http://rmannibucau.wordpress.com
>> https://github.com/rmannibucau
>>
>>
>> 2014-10-20 15:34 GMT+02:00 José Luis Cetina <maxtorz...@gmail.com>:
>> > I changed to:
>> >
>> > <openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1"; xmlns:xsi="
>> > http://www.w3.org/2001/XMLSchema-instance";
>> >              xsi:schemaLocation="http://www.openejb.org/openejb-jar/1.1
>> ">
>> >     <pojo-deployment  class-name="jaxrs-application">
>> >          <properties>
>> >             cxf.jaxrs.providers =
>> > com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider
>> >         </properties>
>> >     </pojo-deployment>
>> > </openejb-jar>
>> >
>> >
>> > resources.xml
>> >
>> > <resources>
>> >     <Service id="json"
>> > class-name="com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider">
>> >         serializeAsArray = true
>> >     </Service>
>> > </resources>
>> >
>> >
>> > and didnt work, what is the value of id in service tag? is json correct?
>> do
>> > i have to set the same class name in both files?? i really dont
>> understand
>> > this config.
>> >
>> > 2014-10-19 2:24 GMT-05:00 Romain Manni-Bucau <rmannibu...@gmail.com>:
>> >
>> >> If you have a custom jaxrs application class-name should be its name.
>> >>
>> >> And once you use resources, providers values should be their ids (json
>> >> here) in openejb-jar.
>> >>  Hi,
>> >> I usually add my own @provider / "extends JacksonJaxbJsonProvider")
>> >>
>> >> and set all my needed objectmapper options there.
>> >>
>> >> br hw
>> >>
>> >>
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> >>
>> http://tomee-openejb.979440.n4.nabble.com/serializeAsArray-JacksonJaxbJsonProvider-tp4672427p4672431.html
>> >> Sent from the TomEE Users mailing list archive at Nabble.com.
>> >>
>> >
>> >
>> >
>> > --
>> > -------------------------------------------------------------------
>> > *José Luis Cetina*
>> > -------------------------------------------------------------------
>>
>
>
>
> --
> -------------------------------------------------------------------
> *José Luis Cetina*
> -------------------------------------------------------------------

Reply via email to