Hi all,
I am currently trying to bind some nested JSON to a list view item, I have successfully done this for one nested item shown below:
/<strong class="oj-flex-item" data-bind="foreach: resource.name"><span data-bind="text: family"></span></strong>/
JSON structure attached as screen shot for this,
How ever, when trying to bind the "code" for the value of "coding" using
/<strong class="oj-sm-flex-initial oj-flex-item oj-text-sm" data-bind="foreach: resource.practitionerRole"><span data-bind="foreach: role.coding"><span data-bind="text: code"</span></span></strong>/
JSON data also in screenshot.
I am getting an error, this is because some of the JSON objects do not have a value for role.coding.code, what can I do to handle list items that are fetched where this JSON data is not present and instead switch out the code value with a "Not specified" or such string? Would it be possible to use a KO if on the listview template to look at the value of resource.practitioner.role, and if no value is found - replaced the strong/span element above with a span to display the exception "not specified" message?
I have attached two images to show how the JSON response for the practitionerRole can vary from having an attribute for role and some not.

Alternatively, Is there a cleaner way to bind these heavily nested object to the list items?
Note the data is dummy data provided by for public access.
With thanks,

