JSON Payload for HAPI/FHIR

Hello - I am trying to test creating a FHIR compliant JSON payload to send to hapi.fhir.org/Patient.  Here is what I done so far.

created an expression to create the JSON payload:

concat( "{","""resourceType""",":","""Patient""",",","""name""",":[{","""use""",":","""official""",",","""text""",":","""Brian Doe""",",","""family""",":","""Doe""",",","""given""",":","[","""",tostring(ri!firstName),"""","]","}","]",",","""gender""",":","""male""",",","""birthDate""",":","""2000-04-30""","}"
)

This gives me: 

"{"resourceType":"Patient","name":[{"use":"official","text":"Brian Doe","family":"Doe","given":[""]}],"gender":"male","birthDate":"2000-04-30"}"

When I put this in the integration's request body, it results in errors.  First error is because of the " at the start and the end.  I removed those manually and then it gives an 'open bracket' error.  The open error seems to be because of [ brackets.  If I remove all [ brackets, and the payload is now

{"resourceType": "Patient", "name": {"use": "official","text": "Brian Doe","family": "Doe","given": "Brian"},"gender":"male","birthDate": "2000-04-30"}

The API returns success.  Any suggestion on how I can get the payload to be generated without the string so I can pass it to the integration as a parameter and keep the [ brackets? 

Thank you!

John.

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data