Home Search

DriveWorks Pro 21
JsonEscape

Send Feedback

JsonEscape

Converts a string to its JSON string representation.

Syntax

JsonEscape([JSON])

Where:

JSON is JSON data as text.

The following characters are escaped in this function:

  • Backspace is replaced with \b
  • Form feed is replaced with \f
  • Newline is replaced with \n
  • Carriage return is replaced with \r
  • Tab is replaced with \t
  • Double quote - "" is replaced with \"
  • Backslash is replaced with *

Example

RuleResultMeaning
JsonEscape(DWVariableColorJSON)
"[\n\t{\n\t\tcolors:
\"red\tand\tgreen\"
,\n\t},\n\t{\n\t\tcolors:
\"blue\tand\tyellow\"
,\n\t}\n]"
Will convert the JSON string to its escaped JSON string representation.

Example Data

The value held in the variable DWVariableColorJSON would look like the example below:

"[
    {
        colors: ""red     and     green"",
    },
    {
        colors: ""blue    and     yellow"",
    }
]"