This SOUNDS like a bug in jettison.   If you could create a small sample that 
just uses the Jettison stream and a JAXBContext that shows this and post that 
into the jettison bugs:
http://jira.codehaus.org/browse/JETTISON
that would be best.

Dan


On Wed March 25 2009 5:47:47 am felixsch wrote:
> Hi,
>
> I'm using cxf 2.2 to provide a REST Service which produces XML and JSON. I
> have a Dto which contains two String fields and two fields of type
> Vector<String>.
> What happens is, that all fields, that are declared after the first vector,
> are returned as elements of this vector.
>
> Example:
>
> @XmlRootElement
> @XmlAccessorType(XmlAccessType.FIELD)
> public class Someclass {
>     String str1 = "str1";
>     Vector<String> vec1 = new Vector<String>(); // contains elements
> "vec1elem1" and "vec1elem2"
>     String str2 = "str2";
>     Vector<String> vec2 = new Vector<String>(); // contains elements
> "vec2elem1" and "vec2leme2"
> }
>
> If I use XML as return value everything works fine. But JSON looks
> something like this:
> {"Someclass":{"str1":"str1","vec1":["vec1elem1","vec1elem2","str2","vec2ele
>m1","vec2elem2"]}}
>
> All following fields and all elements of following vectors are added to the
> first vector.
>
> What I tried was to set the AccessorType to NONE and add a @XmlElement
> annotation to each field - this didn't change anything.
>
> What works, is to add a @XmlList annotation to each vector. Then the fields
> are interpreted correctly, but I don't really like the XmlList
> representation.
>
> Is there any way to fix this?
>
> Thanks for your help,
> Felix

-- 
Daniel Kulp
dk...@apache.org
http://www.dankulp.com/blog

Reply via email to