I'm using Jackson to serialize/deserialize JSON objects.
I have the following JSON for a Study
object:
{
"studyId": 324,
"patientId": 12,
"patient": {
"name": "John",
"lastName": "Doe"
}
}
UPDATE: Unfortunately the JSON structure cannot be modified. It's part of the problem.
I would like to deserialize the object to the following classes:
public class Study {
Integer studyId;
Patient patient;
}
and
public class Patient {
Integer patientId;
String name;
String lastName;
}
Is it possible to include the patientId
property in the Patient
object?
I am able to deserialize the patient
object into the Patient
class (with the corresponding name
and lastName
properties), but unable to include the patientId
property.
Any ideas?