Convert your FHIR JSON -> XML and back here. The CDA Book is sometimes listed for Kindle here and it is also SHIPPING from Amazon! See here for Errata.

Thursday, September 3, 2015

My FHIR JSON->XML Converter in JavaScript is now on GitHub

So, I've updated the FHIR Converter, fixed some bugs and posted it on GitHub for folks to play with. It is presently based on the DSTU 2 QA release and XML Schema.  You can try it out at my test page.

Usage is fairly straight-foward:
  1. First you create a new converter, specifying the indent level to use in the XML.
    var FHIR_JSONtoXML = new FHIRConverter(2); 
  2. Then you convert the FHIR JavaScript object
    var xml = FHIR_JSONtoXML.toXML(object); 

The toXML() member function will convert the object to an XML representation. It assumes that the object itself complies with the FHIR specification, and does not (yet) attempt to handle input implementation errors or validation.

I've tested it with the FHIR JSON Discharge Summary Example (since my main goal was to support FHIR to CDA conversion), but none done a lot of other testing.

Some things it doesn't yet handle (or which I haven't tested) are extensions and identifiers on primitive types.  Please log your bugs over on GitHub.  I'm not committing to keep this up in GitHub, but others might find it useful, and if the FHIR Core team thinks it is worthy of putting into the build, then I will volunteer to maintain it.  If that happens, I'll let you know.