I have a REST service endpoint that accepts JSON in the following format:
{
"name": "example",
"properties": {
"key1": "val1",
"key2": "val2"
}
}
Then I have this class
class Document {
private String name;
private Map<String, String> properties;
... setters/getters
}
And my REST service method
logger = Logger.getLogger("logger");
@POST
@Consumes(MediaType.APPLICATION_JSON)
Response addDocument(Document document) {
logger.info(document);
return Response.ok(200).build();
}
But whenever I post the JSON above it's not unmarshalling my properties. It is always null. The name property is mapped correctly..
I would gladly accept any help/clues.Thanks!
EDIT: I did not mention that I am using glassfish 4.1 and what comes with it. I don't have any lib dependency for marshal/unmarshal.