So, I have a CF function inside a cfc file that queries my
SQL database and then returns the CF query object. One of the
database fields is an nvarchar field contains a bunch of check
numbers, some of which have leading zeros.
The example I have used is a field containing the string
"02":
If I use cfdump, it shows up correctly as 02.
If I call the cfc directly from my browser and ask it for
wddx, I get the correct result <field
name='CHECKNUMBER'><string>02</string></field>
If I call the cfc directly from my browser and ask for json,
I get 2.0 back. WRONG.
Is CF8 just naively guessing the datatype when is does JSON
serialization? CF query objects have types in them and it does it
correctly in the other two cases so it obviously has the correct
type information available. I ended up retrieving WDDX instead of
JSON and deserializing it into a Javascript object using the
wddxDes.js file from
www.openwddx.org. I also find it strange and
annoying that the matching wddx.js file from the same web site is
included with the standard installation of Coldfusion but the
deserializer part is not. Has anyone else run into these problems
or found a solution that works without extending Coldfusion with
outside help? This just seems like a straight-up bug in CF8 to
me.