DeserializeJSON

Converts a JSON (JavaScript Object Notation) string data representation into CFML data, such as a struct or array.

Returns: any

Usage

DeserializeJSON( JSONVar [, strictMapping ] )

Arguments

Argument Description Default
JSONVar
(string, required)

A string that contains a valid JSON construct, or variable that represents one.

strictMapping
(boolean, optional)

A Boolean value that specifies whether to convert the JSON strictly

true

Examples

someJson = '{"stringValue":"a string", "arrayValue": ["a","b","c"], "booleanValue":true, "numericValue": 42}';
myStruct = deserializeJson(someJson);

writeDump(myStruct);

Credit to Adam Cameron for suggesting the example

See also