So I have this Object, comes from back from ColdFusion to Flex. It's an Array that contains a Struct that is supposed to contain an Array. I use ActionScript to convert this easily to an ArrayCollection containing one or more ArrayCollections. Simple stuff, works great.
Well I should say it works great as long as the internal most Array has a length of at least 1. When the Array (in CF) has a length of 1, it gets converted to a Struct. So you end up with an Array containing a Struct, that contains a Struct. Again, pretty straight forward, as long as you understand that a Struct can't be converted to an Array, does not have a length and can not be looped through.
My solution, check the length, if it comes back as
undefined
, it's a Struct, else it's an Array. At least I only pulled my hair out for an hour or so to figure that out...
No comments:
Post a Comment