I noticed something funny with serializeJSON when it's passed a query containing dates (in this case, from SQL Server, but it could be other date data).
When I inspect the query before it's passed in the date looks like this:
2000-09-05 00:00:00.0
The generated JSON looks like this:
{"COLUMNS":["START_DATE"],"DATA":[["September, 05 2000 00:00:00"]]}
I understand from the docs that the dates are intended to be acceptable for use in a JavaScript Date object. Aside from the debatable design decision of assuming that's how everyone wants dates formatted coupled with that to not provide for a way to disable this obligatory helpfulness, I am noticing that the comma is in an odd location.
I would expect September 05, 2000 00:00:00
rather than having the comma after the month.
Is there any way to get the serializeJSON function to leave the dates alone or to specify a format string? If not I suppose I'll be reduced to using something like regexreplace after it's generated to repair the damage (since the php site consuming the output doesn't recognize the comma-after-month version as a valid date).
new Date()
on those strings one way or the other - and CFs format seems to work well with that. – Weasandnew Date()
ends up being involved (or how PHP handles date strings in various formats, other than that it chokes when it sees a comma after the month). As you say, dates aren't considered in the JSON spec, so I guess replacing one string with another is a CF serialization implementation assumption/convenience rather than anything to do with the rendered JSON or how it's handled by the consumer. – Merger