$decodeUrlComponent
$decodeUrlComponent(string?) -> stringCompact type signature
<s-:s>If string is omitted, the current context value is used.
Source: JSONata
Documentation
Decodes a single URL-encoded component using decodeURIComponent() semantics.
Use this for individual path segments or query parameter values rather than whole URLs. Undefined input returns undefined, and malformed escape sequences raise the same FUME URI error used by the other URL helpers.
Examples
Decode an encoded display name
Input
This example uses the patient-summary example input. The expression encodes the display name as a URL component and then decodes it again.
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
$decodeUrlComponent($encodeUrlComponent(name.display))
Result
"Avery Reed"