nazrulworld / fhir.resources

FHIR Resources https://www.hl7.org/fhir/resourcelist.html
https://pypi.org/project/fhir.resources/
Other
365 stars 104 forks source link

Resource / element to be json-serializable #146

Closed vadi2 closed 8 months ago

vadi2 commented 8 months ago

Description

How can I make a resource or an element be easily serializable? I'm populating a non-FHIR dictionary with FHIR elements and I'd like to then json.dump it.

What I Did

At the moment I'm doing json.loads(element.json()) to make it easily serializable, but that's not very efficient.

nazrulworld commented 8 months ago

@vadi2 did you tried element.dict()?

vadi2 commented 8 months ago

That was it. Thanks!