Skip to main content

$decodeUrl

$decodeUrl(string?) -> string
Compact type signature<s-:s>

If string is omitted, the current context value is used.

Source: JSONata

Documentation

Decodes a full URL string using decodeURI() semantics.

Use this helper for complete URLs, not isolated path or query fragments. Malformed encoded input raises the same FUME URI error used by the other URL helpers, and undefined input returns undefined.

Examples

Decode a full patient URL

Input

This example uses the patient-summary example input. The expression round-trips a full patient URL through $encodeUrl() 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

$decodeUrl($encodeUrl("https://example.test/patient/" & patientId & "?display=" & name.display))

Result

"https://example.test/patient/pat-0001?display=Avery Reed"