View raw Markdown
type: fhirpath-functionfunction: escapecategory: Additional String Functionssection: 5.7.3source: fhirpath/functions.json

FHIRPath Function: escape

{:.stu}

The escape function takes a singleton string and escapes it for a given target, as specified in the following table: {:.stu}

|html |The string is escaped such that it can appear as valid HTML content (at least open bracket (<), ampersand (&), and quotes ("), but ideally anything with a character encoding above 127) | |=|=| |json |The string is escaped such that it can appear as a valid JSON string (quotes (") are escaped as (\")); additional escape characters are described in the String escape section| {:.grid} {:.stu}

If the input is empty, the result is empty. {:.stu}

If no target is specified, the result is empty. {:.stu}

Summary

Description

The escape function takes a singleton string and escapes it for a given target. Available targets are html and json.

Arguments

Type Mapping

Example

'"test"'.escape('json') // returns '\"test\"'