0

In the spec. documnent, http://www.hl7.org/implement/standards/fhir/query.htm#base

The server returns the results in the HTTP response as a bundle (in XML, an atom feed) which includes the resources that are the results of the query

In JSON, what is the format required for the results ?

It seems that no JSON format is defined for an atom feed. The examples on the servers like on http://hl7connect.healthintersections.com.au/svc/fhir use a straightforward conversion (XML -> JSON). Confirmed ?

IMHO, a precision on the expected format should be explicitly defined.

Fred Laurent
  • 1,537
  • 1
  • 12
  • 14

2 Answers2

2

The JSON format for bundles is documented here: http://hl7.org/implement/standards/fhir/json.htm#json-bundles

Grahame Grieve
  • 3,538
  • 3
  • 15
  • 17
  • Thank you Grahame, I missed these part, so sorry. – Fred Laurent Aug 20 '13 at 07:00
  • The § 1.10.4.2.1 explains that the id attribute have to be converted into a "_id" JSON element (as the examples : dob and Person). But in the others examples, the id attribut (atom) is represented by an "id" key in json. Same thing in the response of the server. So what is the recommandation "id" or "_id" ? – Fred Laurent Aug 20 '13 at 13:55
  • In atom, the id is an element not an attribute, so it doesn't get renamed to _id – Grahame Grieve Aug 20 '13 at 20:21
  • ok I need to go back on vacation... So XML element id -> "id" in json, XML attribute id -> "@id" in json. Clear. Thanks. – Fred Laurent Aug 21 '13 at 07:34
1

use a straightforward conversion (XML -> JSON). Confirmed ?

Please note that converting from xml to json is never that straightforward: both in Resources and in the Bundle format you need knowledge of

  1. Which elements repeat: in xml elements simply repeat, in the FHIR Json representation repeated items (even if there's only one!) are always rendered in arrays
  2. The type of element: while in xml all elements use a textual 'value' attribute, elements of type bool, int and decimal are rendered using the native Json type.

This requires your xml -> json convertor to have knowledge about the model (cardinality, element types). If at all possible, you can use the C# and Java parsers/serializers that come with FHIR to help you do this.

Ewout Kramer
  • 984
  • 6
  • 9
  • I see that in version 1.10.5.2 of http://www.hl7.org/implement/standards/fhir/json.html, the json properties are no longer wrapped in .value properties. Yet the Java serializer and the reference implementations still use the .value format. Will they be updated? – flup Nov 24 '13 at 23:31
  • Yes, we have restructured the Json format. The Java (and .NET) reference implementations do not yet reflect this. These will be updated in the coming weeks. – Ewout Kramer Dec 19 '13 at 13:41
  • Actually, we had a freeform hackathon today and the Java reference implementation did the (seemed to do the?) 0.12 job fine! – flup Dec 19 '13 at 22:11