Stream: implementers
Topic: Using json _ notation for array of strings
Sean McIlvenna (Mar 07 2020 at 20:32):
Reading http://www.hl7.org/fhir/json.html and something isn't clear to me:
I'm trying to figure out how to represent the http://hl7.org/fhir/StructureDefinition/elementdefinition-profile-element extension in JSON.
In XML, the extension is like so:
<type> <code value="BackboneElement"/> <profile value="http://hl7.org/fhir/test/StructureDefinition/document-section-library"> <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-profile-element"> <valueString value="Composition.section:codeB"/> </extension> </profile> </type>
But in JSON, I'm not sure how I would represent that extension, since in the JSON it is just an array of strings like so:
{ type: ['profile1', 'profile2', 'etc.'] }
I don't see any examples of how to do this. Would I just create an array of _type, that aligns with the number of elements in the array of strings?
{ type: ['profile1', 'profile2', 'etc.'], _type: [{ extension: [{ ... }] }, { extension: [{ ... }] }, { extension: [{ ... }] }] }
@Grahame Grieve
Grahame Grieve (Mar 07 2020 at 21:56):
yes. for an example, see http://hl7.org/fhir/json.html#primitive, and see the example starting with <code value="a"/>
Sean McIlvenna (Mar 08 2020 at 01:12):
Ahh... now I see it. Not sure why it took you telling me to look at it for my eyeballs to see it LOL
Eric Haas (Mar 08 2020 at 02:03):
lots o examples of primitive extensions in US Core -e.g: http://hl7.org/fhir/us/core/SearchParameter-us-core-allergyintolerance-clinical-status.json.html
Last updated: Apr 12 2022 at 19:14 UTC