deserializeJSON

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

deserializeJSON(json [, strictMapping, useCustomSerializer, preserveCaseForStructKey]) → returns any

Argument Reference

json string
Required

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

strictMapping boolean
Default: true

A Boolean value that specifies whether to convert the JSON strictly. If true, everything becomes structures. CF 2025+ Pass query to return a JSON array of objects as a query.

useCustomSerializer boolean
Default: true

preserveCaseForStructKey boolean
Default: false

CF 2025+ Keep the case of struct keys from the JSON.

Compatibility

Lucee:

Lucee has only support for the first two parameters

OpenBD:

In OpenBD it's possible to pass in a file path as third parameter instead of useCustomSerializer which will be used in place of the JSON passed with the first parameter You can pass the parameters as a structure ("ArgumentCollection") as well

Examples
Sample code invoking the deserializeJSON function

person = deserializeJSON( '{"company":"Foundeo","name":"Pete Freitag"}' );
writeOutput( person.company );

Expected Result: Foundeo

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub