This content has been marked as final. Show 4 replies
struct = StructNew();
struct.key1 = "Key 1";
struct.key2 = "Key 2";
struct.key3 = "Key 3";
myJSONStruct = SerializeJSON(struct);// converts the structure to a JSON string
myStructBack = DeserializeJSON(myJSONStruct);
<cfdump var="#myJSONStruct#" />
<cfdump var="#myStructBack#" />
Of course, you'll need to know how to use a JSON string/object in your JS for this to be helpful but this will convert your struct to a string representation and allow you the option to convert it back in CF, if needed.
Yes, you absolutely can using WDDX. There are a few caveats, though, like ampersands. Before I deserialize the structure I change them all to &.
I use this method to both store structures in a database and pass them as hidden form fields. Works like a charm!
> There are a few caveats, though, like
What's the caveat with ampersands?