Not really, it is an explicit collection so the wrapper needs to be customized,
When using JSONProvider, see
http://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-JSONsupport, "Handling Explicit collections"

HTH, Sergey


On 17/01/14 19:29, Jose María Zaragoza wrote:
2014/1/17 fthouny <[email protected]>:

I need to have the following xml and json (using
org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider) outputs :

<?xml version="1.0" encoding="UTF-8"?>
<countries>
    <country>
       <code>AF</code>
       <name>Afghanistan</name>
    </country>
    <country>
       <code>AL</code>
       <name>Albania</name>
    </country>
    ...
</countries>

[
    {
       "code":"AF",
       "name":"Afghanistan"
    },
    {
       "code":"AL",
       "name":"Albania"
    }
    ...
]

Thanks for your help,

Fabien


Hello:

I guess that you need to return a Countries object with
@XmlRootElement(name = "countries"), don't you ?

Regards



Reply via email to