This page is part of the FHIR Specification (v5.0.0-ballot: FHIR R5 Ballot Preview). The current version which supercedes this version is 5.0.0. For a full list of available versions, see the Directory of published versions
FHIR Infrastructure Work Group | Maturity Level: Normative | Standards Status: Normative |
This specification defines the following ways to represent resources when they are exchanged:
Additional Bulk Data Formats are also undergoing exploration. Other representations are allowed, but are not described by this specification.
Systems SHALL declare which format(s) they support in their Capability Statement.
If a server receives a request for its Capability Statement in
a format it does not otherwise support, it SHALL return a 406 Not Acceptable
. Note:
406
is the appropriate response when the Accept
header requests a format that the server
does not support, and 415 Unsupported Media Type
when the client posts a format that is not supported
to the server.
Clients and servers can choose what syntax(s) to implement. In the interests of interoperability, servers SHOULD support both the XML and JSON formats, which have the same functionality, for different technical stacks. The RDF format has quite different benefits - primarily around data analysis rather than exchange.
The JSON format is similar to the XML format:
There are differences between XML and JSON:
resourceType
id
, value
) are handled differently (see below)<div>
element in the Narrative datatype is represented as a single escaped string of XHTML. This is to avoid problems in JSON with mixed content, etc. The XHTML SHALL still conform to the rules described for the NarrativeImplementers should be aware of the difference in this serialization behavior when converting between the syntaxes, including its ramifications on digital signature canonicalizations. The XML format for the resources follows the JSON format closely to make interconversion easy, and so that XPath queries can easily be mapped to query the JSON structures. However, the differences - particularly the repeating element one, which cannot be avoided - mean that generic XML --> JSON converters are not able to perform correctly. The reference platforms provide XML <--> JSON conversion functionality that accommodates these FHIR-specific characteristics.
String handling is slightly different between XML and JSON
Unlike this rest of this page, the bulk use formats are draft until further experience is gained with their use. Their status will be reviewed in a future version of FHIR.
The XML and JSON formats are designed to support typical system process-based data exchange uses. FHIR is also used to exchange large amounts of data- 1000s of records, or more (up to billions). The formats above can be used for this, but more suitable formats exist. This specification documents (or is exploring documenting) the following formats: