$omitKeys
$omitKeys(object?, keysToOmit?) -> objectCompact type signature
<o-a<s>?:o>If object is omitted, the current context value is used.
Source: FUME
Documentation
Returns a new object with the named keys removed.
keysToOmit can be a single string or an array of strings, and each selector is compared to object keys using string conversion. If keysToOmit is undefined or null, the function returns a shallow copy of the original object.
Examples
Remove keys from an object
Input
This example uses the patient-summary example input. The expression selects patientId, sex, and birthDate, then removes birthDate.
Example input
JSON
{
"patientId": "pat-0001",
"name": {
"given": "Avery",
"family": "Reed",
"display": "Avery Reed"
},
"birthDate": "1990-06-12",
"sex": "female",
"primaryCareTeam": {
"organization": "ExampleCare",
"facility": "ExampleCare Clinic",
"practitioner": {
"practitionerId": "prac-4001",
"display": "Jordan Kim"
}
},
"identifiers": {
"memberId": "mbr-3001",
"recordNumber": "rec-5001"
},
"tags": [
"demo",
"fictional"
],
"_xmlTagName": "patientSummary"
}
Expression
$omitKeys($selectKeys($, ["patientId", "sex", "birthDate"]), ["birthDate"])
Result
{
"patientId": "pat-0001",
"sex": "female"
}