users@jersey.java.net

Different format in XML and JSON

From: bea <beaotx_at_gmail.com>
Date: Wed, 7 Oct 2009 16:05:47 +0200

Hi,

I use a JAXBContextResolver with natural JSON notation. I've an object with
a Collection called "groups". In JSON I get the following result:

{ ... "groups":["group1", "group2", "group3"] ... }


But in XML format I get:

....
<groups>group1</groups>
<groups>group2</groups>
<groups>group3</groups>
....


I'd like to know if it's possible to modify only the XML ouput in this way:

<groups>
    <group>group1</group>
    <group>group2</group>
    <group>group3</group>
</groups>

keeping the same JSON output.

Cheers