tags:

views:

298

answers:

1

I am maintaining this servlet that has a HttpServletResponse response that replies back to the client an XML message. I want to take the XML message and convert it to JSON, then send the JSON back.

I want to avoid writing my own JSON converter if possible. Does anyone have a good method of doing this? I googled for this: http://pvoss.wordpress.com/2009/02/26/servlet-filter-to-convert-xml-to-json/ , which is exactly what I want but they are using a hacked dom4j jar which doesn't help me.

A: 

Possibly use Json-lib to roll your own filter?

Check out the snippets for inspiration, and see the Javadoc section on XMLSerializer?

toolkit
Thanks. Works like a charm
Mike