In my spring-mvc application, the client requests with a key and I lookup the associated value in Couchbase. From Couchbase I get a json object as a String, as my application doesn't need to do anything with it I just want this to be written out.
But Spring sees that I want to write a String, and passes it to jackson which then writes it as a json string - adding in quotation marks and escaping the internals.
Simplest example:
@RequestMapping(value = "/thing", method = RequestMethod.GET, produces = "application/json")
@ResponseBody
public DeferredResult<String> getThing() {
final DeferredResult<String> result = new DeferredResult<>();
// in future
result.setResult("{}");
return result;
}
Returns: "{}"
I'm thinking of making a serialised json wrapper and a custom serialiser for jackson to just output it's contents.