I have a Spring REST controller that serializes an entity (default behaviour). For one of the fields of this entity I would like to save the actual Json (and not deserialize it).
For example:
Entity:
class Person:
String name
String data
Post to /person/1
{
'name': 'John',
'data': {'age': 35, 'job': 'engineer'}
}
The default deserialization won't handle {'age': 35, 'job': 'engineer'}
as a String value. It throws an exception (com.fasterxml.jackson.databind.JsonMappingException).
Is there a way to accomplish this easily? I prefer to not write my own serializer/deserializer.