camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eugeniu <>
Subject Re: Configure json to use jaxb annotations
Date Tue, 08 May 2012 14:41:05 GMT
Hi Christian

I used the jettison library shipped with the jaxrs implementation. 

Here you can find some more information:

This is a link for the library:

And this is a marshal method I used to create a json string from my
annotated JAXB java class:

    public void marshal(Exchange ex) throws JAXBException {
        Configuration conf = new Configuration();
        MappedNamespaceConvention mnc = new MappedNamespaceConvention(conf);
        Writer writer = new StringWriter();
        XMLStreamWriter xmlStreamWriter = new MappedXMLStreamWriter(mnc,
        Object obj = ex.getIn().getBody();
        JAXBContext jc = JAXBContext.newInstance(obj.getClass());
        Marshaller marshaller = jc.createMarshaller();
        marshaller.marshal(obj, xmlStreamWriter);
        String json = writer.toString();

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message