# JavaScript



# Functions

- **function-deserializejson** - Converts a JSON (JavaScript Object Notation) or JSON5 string data representation into CFML data, such as a struct or array.
- **function-encodeforjavascript** - Encodes the given string for safe output in JavaScript to reduce the risk of Cross Site Scripting attacks.
- **function-esapiencode** - Deprecated legacy function. Use context-specific functions (e.g., encodeForHTML) instead.
- **function-guardencode** - Deprecated legacy function. Use context-specific functions (e.g., encodeForHTML) instead. Encodes data for a specific output context. This is a vital defense against Cross-Site Scripting (XSS) and injection attacks by ensuring characters are treated as data rather than executable code.
- **function-isjson** - Evaluates whether a string is in a valid JSON (JavaScript Object Notation) or JSON5 data interchange format.
- **function-jsstringformat** - Escapes special JavaScript characters, such as single quotation mark, double quotation mark, and newline
- **function-serializejson** - Converts CFML data into a JSON (JavaScript Object Notation) representation of the data.
- **function-toscript** - Creates a JavaScript expression that assigns the value of a variable to a JavaScript variable. This function can convert strings, numbers, arrays, structures, and queries to JavaScript syntax that defines equivalent variables and values.

# Methods

- **method-any-tojson** - Converts CFML data into a JSON (JavaScript Object Notation) representation of the data.
- **method-string-deserializejson** - Converts a JSON (JavaScript Object Notation) or JSON5 string data representation into CFML data, such as a struct or array.
- **method-string-encodeforjavascript** - Encodes the given string for safe output in JavaScript to reduce the risk of Cross Site Scripting attacks.


# Categories

[Ajax features](ajax.md)