Hi!
I have a problem. I need one of the methods that serves the my REST API to
produce "application/json". The problem is that I inside that method the
information is already in JSON format. So, Jersey makes the marshalling over
a marshalled data.
The code:
/_at_GET
@Path("/query.json")
public Response excecuteSPARQLJSONQuery(@QueryParam(value = "q") String
query) {
return excecuteQuery(query,Format.JSON,Language.SPARQL);
}
private Response excecuteQuery(String query, Format format, Language
language){
...
try {
body = repositoryGateway.query(format, query,
language);
...
resp = Response.ok(body,MediaType.APPLICATION_JSON_TYPE).build();
}else{
resp = Response.ok(body,MediaType.APPLICATION_XML_TYPE).build();
}
...
...
return resp;
}/
I would like to get for example something like this:
*{
"head": {
"vars": [ "s", "p", "o" ]
}
}*
Instead of that i get this:
*"{\n\t\"head\": {\n\t\t\"vars\": [ \"s\", \"p\", \"o\" ]\n\t}\n}"*
It looks like jersey replace the \n and \t and marshall the json inside
another json.
How can avoid this behaviour?
Thanks in advance,
Juan.
--
View this message in context: http://jersey.576304.n2.nabble.com/How-to-avoid-JSON-marshalling-over-an-already-JSON-object-tp6624356p6624356.html
Sent from the Jersey mailing list archive at Nabble.com.