title: Properly return org.w3c.dom.Document as JSON using Jersey
body: <p>I have a function which returns type org.w3c.dom.Document, and my Jersey resource lets it return either as XML or JSON. It returns the XML fine, however, for JSON,  it returns a simple string, which is just the XML using Application/JSON. How can I make it encode to JSON properly?</p>
  
  <p>I'm open to changing the return type of the function to something that can properly be serialized by Jersey</p>