On Mar 9, 10:54 am, Scott Brady <[email protected]> wrote:
> On Mon, Mar 8, 2010 at 1:16 PM, Elliott Sprehn <[email protected]> wrote:
> > Why do you need date objects? CF should automatically handle dates for
> > you in almost all cases. Curious where you're seeing issues with the
> > date being a string.
>
> I posted about this a few months ago, as well.  Not everything we use
> the results for are strictly ColdFusion.  I had an issue where I was
> serializing the result into json, which doesn't work, because JS
> didn't recognize the object as a date (CF's serializeJson() function
> treated it like a string, and not a date).
>
> For that case, I had to serialize the json manually.

Just write your own method on the decorator getSerializableData() that
calls the getters and does the post processing you need, converts to
dates, etc., that's how we've done it for Flex and JS clients.

You really don't want to use serializeJSON anyway. It does awful
things to numbers in strings. If a user enters a long number into a
string field, CF will convert it into a number when it serializes and
the loss of precision destroys the value. This is particularly
noticeable for very large numbers like a serial number. Try
alert(1028171721999191919) in your browser the result is surprising
(especially if you don't understand IEE754). CF similarly clobbers
booleans in some cases. That one might have been fixed in CF9, but the
bugs are still numerous:

http://www.coldfusionjedi.com/index.cfm/2009/10/19/ColdFusion-9-JSON-Bug

CF really should allow a second argument to serializeJSON like
serializeJSON(value,{"key"="numeric","sub"=[{"key"="date"}]}) to hint
at the serializer. It'd also let you get the casing of the keys right.
Maybe I'll suggest for CF10, but anyway, I'd suggest staying away from
serializeJSON(), it's buggy as hell.

-- 
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer

Try out the new Transfer ORM Custom Google Search:
http://www.google.com/cse/home?cx=002375903941309441958:2s7wbd5ocb8

You received this message because you are subscribed to the Google Groups 
"transfer-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en

Reply via email to