This one has gotten me several times. With the new structure literal notation in CF8, you have to use equal signs between the key-value pairs. In other places where you use key-value pairs (like passing named params to a UDF), you can use equals signs or colons, but not so with structure literals.
I have to say, I was quite excited for structure and array literals in CF8, but man have I been disappointed. No nesting cripples them to near worthlessness, and this (seemingly random) inconsistency adds further annoyance. I'd have been happier if they'd just been omitted until they could have been done reasonably.
I completely agree that they are crippled to near worthlessness.
If I can't use them like the following, then what's the point?
Struct = {'StructNotationInCF':{'HasTheFollowingProperties':["Can't be nested","Can't be used as function parameters","Really can't do much"]}};
Sort of a useless comment, but I have to say…no nesting? WTF?
Hello Barney,
Can you create a nested struct-equivalent in server side javascript and pass it back to the cf layer?
Regs,
/t
I imagine Adobe also realizes the uselessness of the feature without nesting. After all, plenty of programmers work on the CF team. Certainly they use complex data structures.
I am looking for this to be fixed in a point release.
Tanguyr,
Of course. You can pass arbitrarily nested objects back up to CF, and I believe cyclic graphs are supported in both directions. Within the JS runtime, you've got the full scope of JS's syntax.
If you're nested object is entirely comprised of primitives, you can use CFSAVECONTENT and deserializeJson() UDF to synthesize arbitrary nesting. Just throw a JSON string into the CFSAVECONTENT and then deserialize it. Not very elegant, but at least it works.