Skip to content

qie.convertFHIRXMLtoJSON

Signature: qie.convertFHIRXMLtoJSON(message, indent*)

Returns: JSON Message jsonMessage - the JSON message object

Converts an HL7 FHIR XML message object into an JSON message object.

Note

CAUTION! The returned JSON message object may not be in a valid HL7 FHIR format since numbers and booleans may be incorrectly identified as strings and arrays may not be used when they should if only a single value is present.

Parameters

Type Name Description Default
XML Message message the XML message object to convert
Integer indent* (optional) the number of spaces to use for indentation 0

Example

var xmlMessage = qie.parseXMLString('' +
 '<Patient xmlns="http://hl7.org/fhir">\n' +
 '   <id value="example-patient-id"/>\n' +
 '   <!-- JSON array -->\n' +
 '   <name>\n' +
 '      <family value="Doe"/>\n' +
 '      <given value="John"/>\n' +
 '      <given value="Johnny"/>\n' +
 '   </name>\n' +
 '   <gender value="male"/>\n' +
 '   <birthDate value="1990-05-15"/>\n' +
 '</Patient>');

var jsonMessage = qie.convertFHIRXMLtoJSON(xmlMessage);