deserializeJSON
Converts a JSON (JavaScript Object Notation) string data representation into CFML data, such as a CFML structure or array.
deserializeJSON(json [, strictMapping, useCustomSerializer]) → returns any
Argument Reference
json string Required
A string that contains a valid JSON construct or variable that represents one.
strictMapping boolean
Default: true
true
A Boolean value that specifies whether to convert the JSON strictly. If true, everything becomes structures.
useCustomSerializer boolean
Default: true
true
CF 11+ Use custom serializer if defined. See: https://helpx.adobe.com/coldfusion/developing-applications/changes-in-coldfusion/restful-web-services-in-coldfusion.html
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 BoxLang:
Version 1.0.0+
JSONDeserialize in BoxLang. Works with deserializeJSON with the bx-compat-cfml Examples Sample code invoking the deserializeJSON function
person = deserializeJSON( '{"company":"Foundeo","name":"Pete Freitag"}' );
writeOutput( person.company ); Expected Result: Foundeo
© 2012–present Foundeo, Inc. and the CFDocs contributors.
Licensed under the MIT License.
ColdFusion is a trademark of Adobe Systems Incorporated.
https://cfdocs.org/deserializejson