I have an appointment json which I need to cast to DSTU2 HAPI FHIR json object. Any standard library available for the same ? Google gson library works but does not give value to object in fields
{
"resourceType": "Appointment",
"id": "",
"status": "proposed",
"reason": {
"text": "Regular checkup"
},
"description": "",
"slot": [
{
"reference": "bfgf5dfdf4e45g"
}
],
"comment": "Regular yearly visit",
"participant": [
{
"actor": {
"reference": "9sdfsndjkfnksdfu3yyugbhjasbd"
},
"required": "required"
},
{
"actor": {
"reference": "78hjkdfgdfg223vg"
},
"required": "required"
},
{
"actor": {
"reference": "sdfs3df5sdfdfgdf"
},
"required": "required"
}
]
}
Need to convert above json to ca.uhn.fhir.model.dstu2.resource.Appointment class for which I use
Appointment appointment = new Gson().fromJson(map.get("appointment"), Appointment.class);
but it gives appointment object with empty fields