serialize

Serializes the object to a specified type

serialize( Object objToBeSerialized, String type, boolean useCustomSerializer ); → returns String

serialize Argument Reference

objToBeSerialized
Required

An object to be serialized.

type
Required

A type to which the object will be serialized. ColdFusion, by default supports XML and JSON formats. You can also implement support for other types in the CustomSerializer CFC.

useCustomSerializer
Required

Boolean. Whether to use the custom serializer or not. The default value is true. The custom serializer will be always used for XML deserialization. If false, the XML/JSON deserialization will be done using the default ColdFusion behavior. If any other type is passed with useCustomSerializer as false, then TypeNotSupportedException will be thrown.

Examples sample code invoking the serialize function


Tag Syntax

serialize is a new function added in ColdFusion 11. This function will serialize the object to a specified type using ColdFusion's default serialization mechanism.

... <cfreturn serialize(arguments.arg, arguments.type)> 

Fork me on GitHub