The same record, three ways
Health Data Formats: XML, JSON and Turtle: The same record, three ways.
One record. Three sets of rules.
FHIR can write one record in X M L, in JSON, or in Turtle. The meaning is the same. But each format has its own habits, and some of them matter when you read or build a record.
A value, in FHIR XML and JSON
Here is one FHIR element, a gender, in two of the formats. In X M L, the value of a simple element is written in an attribute called value. In JSON, it is just a property with a value. Same element, same meaning, two spellings.
- FHIR XML · <gender value="male"/> · tag
- FHIR JSON · "gender": "male" · box
Order in XML, none in JSON
One habit matters when you build a record by hand. In FHIR X M L, elements must appear in the order the specification documents. In FHIR JSON, properties can appear in any order. In both, names are case sensitive, so a capital letter in the wrong place is a different name.
A rule, and where it applies
Match the rule to the format. A simple value in a value attribute: X M L. A property called resource type, that names the kind of resource: JSON. Elements that must follow the documented order: X M L. And property names that must be unique: JSON. Knowing which rule belongs to which format saves hours when something will not load.
- A simple value in a value attribute · FHIR XML · tag · navy
- A resourceType property names it · FHIR JSON · box · navy
- Elements follow the documented order · FHIR XML · layers · amber
- Property names must be unique · FHIR JSON · key · slate
A job, and its usual format
Which format should you use? For operational exchange, moving data between systems, FHIR users usually choose X M L or JSON. Turtle is different. The specification says the R D F form is meant to bridge operational data exchange and formal knowledge processing, and that systems focused on operational exchange would not usually choose it. Its status is trial use.
- Operational exchange · Usually XML or JSON · share
- Bridging to knowledge systems · Turtle (RDF), trial use · link
Check yourself
Pause and think. In FHIR, which format requires elements in the documented order? The answer: X M L. In JSON, properties can appear in any order.
- XML
- JSON
- Both of them
- Neither of them
Keep these in mind
The same FHIR record can be X M L, JSON or Turtle. In X M L a simple value sits in a value attribute. X M L needs the documented order, and JSON does not. And Turtle suits knowledge systems, not everyday exchange.
- The same FHIR record can be XML, JSON or Turtle
- In XML a simple value sits in a value attribute
- XML needs the documented order; JSON does not
- Turtle suits knowledge systems, not everyday exchange
SNOMED CT®, LOINC®, ICD and other terminologies are the property of their respective owners and are shown for education under their licences. Licences & attributions