Serialize()

Opposite of evaluate, this function serializes all cfml objects and all serializable Java objects. Can also serialize Components.

As objects can be serialized, this is not safe and cannot be trusted like JSON.

Avoid using serialize/evaluate with untrusted end user content, SerializeJSON() / DeserializeJSON() is a safe alternative.

Serialize( object=any );

Returns: String

Argument Description
object
any, required

Examples

struct_object = { name = "Joe", email = "joe@example.com" };
array_object = ["John Doe", { name = "Joe", email = "joe@example.com" }, 1000];
java_object = createObject("java", "java.lang.StringBuffer").init("");

dump(Serialize(struct_object)); // {'name':'Joe','email':'joe@example.com'} dump(Serialize(array_object)); // ['John Doe',{'name':'Joe','email':'joe@example.com'},1000] dump(Serialize(java_object));

See also