Serializes and deserializes CFML data structures to the
XML-based WDDX format. The WDDX is an XML vocabulary for
describing complex data structures in a standard, generic way.
Implementing it lets you use the HTTP protocol to such
information among application server platforms, application
servers, and browsers.

This tag generates JavaScript statements to instantiate
JavaScript objects equivalent to the contents of a WDDX packet
or CFML data structure. Interoperates with Unicode.

  <cfwddx action="cfml2wddx" input="">

 cfwddx(action="cfml2wddx", input="");

Attribute Reference

action string

cfml2wddx: serialize CFML to WDDX
wddx2cfml: deserialize WDDX to CFML
cfml2js: serialize CFML to JavaScript
wddx2js: deserialize WDDX to JavaScript
  • cfml2wddx
  • wddx2cfml
  • cfml2js
  • wddx2js

input string

A value to process

output variableName

Name of variable for output. If action = "WDDX2JS" or
"CFML2JS", and this attribute is omitted, result is output
in HTML stream.

toplevelvariable string

Name of top-level JavaScript object created by
deserialization. The object is an instance of the
WddxRecordset object.

usetimezoneinfo boolean
Default: true

Whether to output time-zone information when serializing
- Yes: the hour-minute offset, represented in ISO8601
format, is output.
- No: the local time is output.

validate boolean
Default: false

Applies if action = "wddx2cfml" or "wddx2js".
- Yes: validates WDDX input with an XML parser using
WDDX DTD. If parser processes input without error,
packet is deserialized. Otherwise, an error is
- No: no input validation

Sample code using the cfwddx tag

Reads instance's scheduled tasks file and converts it into CFML collection

<cfset local.FileContents = FileRead("D:/ColdFusion/#Instance#/lib/neo-cron.xml") />
						<cfwddx action="wddx2cfml" input="#local.FileContents#" output="local.structFileContents" />
<cfdump var="local.structFileContents"

Expected Result: Dump of the Scheduled Tasks cron file stored in the local.structFileContents variable

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

Fork me on GitHub