I am using a jackson provider for my rest service:
<jaxrs:server id="services" address="/">
<jaxrs:serviceBeans>
<bean class="..."/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" />
</jaxrs:providers>
</jaxrs:server>
I have this class:
public class Response {
private Date myDate;
private DataObject data; //data related to that date
}
and this method returning a json:
@Produces("application/json")
public Response getResp(){
Response r = ...
return r;
}
This translates in the following json object
{
"myDate":"20150730",
"data":{
"p1":"v1",
"p2":"v2"
}
}
Is it possible to obtain something like this, instead:
"20150730":{
"p1":"v1",
"p2":"v2"
}
in other words to have the myDate content to be the actual json property and data content to be the json value?