Hi Venkatesh,

Venkatesh wrote:

> I see your question now. I am actually using a JettisonMappedXmlDriver.
> 
> 
> On Sun, Apr 28, 2013 at 9:28 AM, Venkatesh
> <[email protected]> wrote:
> 
>> Jorge:
>>
>> Yes, I need both. So, I also have unmarshal implementation in this class.
>> It works and so I left that out.
>>
>> I register the converter by simply calling xstream.registerConverter(new
>> MyMapConverter(xstream.mapper())).

OK. You will have to overwrite JettisonStaxWriter.startNode(String,Class), 
because the current implementation will tell Jettison to handle a tag as 
JSON array if it is a Map. Normally you would simply overwrite the driver's 
createWriter method, to return your adjusted implementation, but 
unfortunately this is not possible, because you don't have access to the 
objects you need to feed the constructor of JettisonStaxWriter.

So, simply take a private copy of the JettisonMappedXmlDriver and adjust the 
two createWriter methods to return your writer implementation:

 class MyWriter extends JettisonStaxWriter {
   ...
   public void startNode(String tag, Class clazz) {
     if (Map.class.isAssignableFrom(clazz))
       startNode(tag);
     else
       super.startNode(tag, clazz);
   }
 }

Cheers,
Jörg


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to