Skip to content

Commit 7fd4b3c

Browse files
committed
Add documentation about accessing array result
1 parent 775b53b commit 7fd4b3c

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,28 @@ The final mapper will look like this:
195195
}
196196
```
197197

198+
### Accessing array result of expression
199+
200+
From the example above, it's clearly seen that the expression inside `{{ }}` always evaluated as the first element or null.
201+
202+
There's a special syntax for accessing the whole array - `{[ expression ]}`.
203+
204+
For example,
205+
206+
```json
207+
{
208+
"resourceType": "Patient",
209+
"name": [
210+
{
211+
"given": "{[ QuestionnaireResponse.repeat(item).where(linkId='1').answer.value ]}"
212+
}
213+
]
214+
}
215+
```
216+
217+
In this example, the result of the evaluation of the expression will be always an array (empty or with results).
218+
219+
198220
### Null key removal
199221

200222
If an expression resolves to an empty set `{}`, the key will be removed from the object.

0 commit comments

Comments
 (0)