FHIR Chat · JSON serialization and arrays · conformance

Stream: conformance

Topic: JSON serialization and arrays


view this post on Zulip Gino Canessa (May 25 2021 at 17:06):

Hi all, I have a question about JSON serialization on primitive arrays. By my reading on the JSON Page, primitive arrays are supposed to be serialized as null values if elements have extensions.

Looking at the administer-zika-virus-exposure-assessment.json file in the R4 examples package, I see the following:

  "timingTiming": {
    "_event": [
      {
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/cqf-expression",
            "valueExpression": {
              "language": "text/cql",
              "expression": "Now()"
            }
          }
        ]
      }
    ]
  },

I believe it should be serialized as:

  "timingTiming": {
    "event": [
      null
    ],
    "_event": [
      {
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/cqf-expression",
            "valueExpression": {
              "language": "text/cql",
              "expression": "Now()"
            }
          }
        ]
      }
    ]
  },

Thoughts?

view this post on Zulip Grahame Grieve (May 25 2021 at 17:30):

lazy on the nulls; the last ones are dropped

view this post on Zulip Grahame Grieve (May 25 2021 at 17:30):

you could make a task for us to be more explicit about that

view this post on Zulip Gino Canessa (May 25 2021 at 17:30):

So even on arrays, it should be removed? If so, I'll add a ticket to update the documentation.

view this post on Zulip Grahame Grieve (May 25 2021 at 23:07):

well, I do remove it when writing but it's OK for it to be present when reading in my implementations

view this post on Zulip Gino Canessa (May 25 2021 at 23:13):

Hmm. I’ll file a ticket for clarification either way - it’s normative, so we should be specific on the behavior


Last updated: Apr 12 2022 at 19:14 UTC