FHIR Chat · OrderedJson · implementers

Stream: implementers

Topic: OrderedJson


view this post on Zulip Patrick Plattes (Apr 27 2017 at 11:48):

Hello, I am very new to FHIR. I met a guy from the German organization who explained me, that the JSON thas is used must have the key-value pairs in the right order. This seems to me quite strange, since the JSON RFC 7159 explicitly says, that JSON is unordered. Also most of the implementations I know are based on dictionaries, that are also unordered. Was he simply wrong in this point or did I miss something?

view this post on Zulip Lloyd McKenzie (Apr 27 2017 at 11:56):

There is no requirement that JSON elements be ordered - but if you convert to XML, ordering matters

view this post on Zulip Patrick Plattes (Apr 27 2017 at 19:01):

Okay, thank you very much

view this post on Zulip Grahame Grieve (May 01 2017 at 03:36):

the reference implementation carefully maintains order - perhaps that is where the claim comes from. But that is for the convenience of the readers, not because it actually matters

view this post on Zulip Brian Postlethwaite (May 03 2017 at 03:46):

When serializing into an object model from the json, need to process the resource_type before you can select the appropriate object serializer to inflate, so can't stream directly without that property coming first.

view this post on Zulip Brian Postlethwaite (May 03 2017 at 03:47):

I don't recall if the dotnet fhir client has this restriction or not (probably not though)
just a heads up for possible implementer issues.

view this post on Zulip Mattias Flodin (May 03 2017 at 10:37):

I'm working with the .Net implementation right now. It uses Json.NET internally which parses the entire json text into a document object model. I can't imagine that ordering would matter.
On the other hand, the reason I was looking into it was that I am working with potentially large objects and was looking for a way to stream them. I'd say it's likely that the order could matter to some implementations in the future, for this reason.

view this post on Zulip Grahame Grieve (May 04 2017 at 00:27):

we used to say that order mattered for exactly that reason. But Json doesn't work that way, and some of us had to reset our expectations.

view this post on Zulip Grahame Grieve (May 04 2017 at 00:29):

see http://www.healthintersections.com.au/?p=1723

view this post on Zulip Grahame Grieve (May 04 2017 at 00:29):

though I note that json schema has moved along a lot since then


Last updated: Apr 12 2022 at 19:14 UTC