merge

Last updated: Feb 24, 2026
DEVELOPER
IMPLEMENTATION
HEALTH TECH VENDOR

Definition

In a config modifier schema, use merge to avoid overwriting all of the properties of an output. This keyword combines multiple objects into one. If objects share the same property name, the value from the last object overwrites the first one.

Exclusive keywords

If properties, if, concat, switch, pipe, merge, prefer, or items are present at the same nesting level, only the first keyword listed will run. We recommend not listing these keywords together at the same nesting level.

Order of execution

This keyword executes in the following order:

  1. omit
  2. constant
  3. references
  4. use
  5. get
  6. Mutually exclusive keywords at this level:
    • properties
    • if
    • concat
    • switch
    • pipe
    • merge
    • prefer
    • items
  7. default
  8. plugin

Example

You could duplicate the Location resource's name to the description field.

Example: Merge input from initial payload
json
1
"resource": {
2
"description": "Point of Care",
3
"mode": "kind",
4
"name": "USC-IS",
5
"partOf": {
6
"reference": "urn:uuid:8041c338-e0d8-4f60-a658-93d89e86f224"
7
},
8
"physicalType": {
9
"coding": [
10
{
11
"code": "wa",
12
"display": "Ward",
13
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type"
14
}
15
],
16
"text": "wa"
17
}
18
}
Example: Merge selector
json
1
$.entry[?(@.resource.resourceType=="Location")].resource
Example: Config modifier with merge keyword
yaml
1
merge:
2
- {}
3
- properties:
4
description:
5
get: name
Example: Merge output
json
1
"resource": {
2
"description": "USC-IS",
3
"mode": "kind",
4
"name": "USC-IS",
5
"partOf": {
6
"reference": "urn:uuid:8041c338-e0d8-4f60-a658-93d89e86f224"
7
},
8
"physicalType": {
9
"coding": [
10
{
11
"code": "wa",
12
"display": "Ward",
13
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type"
14
}
15
],
16
"text": "wa"
17
}
18
}

Alternative solution with @parent

To achieve the same outcome with the use keyword and @parent variable, try this selector and config modifier instead:

Example: Alternative selector
json
1
$.entry[?(@.resource.resourceType=="Location")].resource.description
Example: Alternative config modifier
yaml
1
use: '@parent'
2
get: name

Learn more about use and parent.

FHIR® is a registered trademark of Health Level Seven International (HL7) and is used with the permission of HL7. Use of this trademark does not constitute an endorsement of products/services by HL7®.