I'm having problems to de-serialize an object containing a JSON field in spring. I have a DataTable
data structure that has both String fields and a field that should contain a JSONObject:
public class DataTable {
private String identifier;
private String version;
private JSONObject content;
//getters and setters
}
I want to be able to persist this object and retrieve it later on.
When I post such a DataTable
object to my Controller and try to retrieve it later, my content
field will be empty, regardless of the contents I posted:
{
"identifier": "id1",
"version": "0.0.1",
"content": {
"empty": true
}
}
It seems that jackson is not able to correctly de-serialize the JSONObject
type field and will just leave it empty instead. How can I make it deserialize the field correctly?