SerializeJSON

Converts CFML data into a JSON (JavaScript Object Notation) representation of the data.

SerializeJSON( var [, queryFormat [, useSecureJSONPrefixOrCharset ] ] )

Returns: String

Argument Description
var
any, required

A CFML data value or variable that represents one.

Alias: data

queryFormat
any, optional

Either a Boolean value that specifies whether to serialize CFML queries by Column, or a string with the value "struct".

Alias: serializeQueryByColumns

useSecureJSONPrefixOrCharset
any, optional

String characters that cannot be encoded by this charset get escaped, if not set the web charset is used.

Alias: charset, charsetName, useSecureJSONPrefix

Examples

myStruct = structNew();
  mystruct.id = 1;
  mystruct.Name = "Water";
  mystruct.DESIGNATION = "Important source for all";
  serialize_test = serializeJSON(myStruct);
  writeDump(serialize_test);

See also