Coldfusion SerializeJSON Function

When passing JSON data to the UI Javascript, we tend to use JSON data very often. One of my servers is running Coldfusion and I have always been using the build-in function SerializeJSON until I got burned today.

My database has an accountnumber column of varchar type. Normally the account numbers are system generated hash values except for a few testing accounts with manually entered strings. Today I found that one such entered “0001” became “1” after javascript received the ajax data. After a little digging, I found that the server side SerializeJSON turned “0001” into “1.0”.

If you are using ColdFusion9 like me, the JSONUtil library can come to help.


If you are using newer versions of Coldfusion, you may want to check out JsonSerializer.

This entry was posted in Coldfusion and tagged , . Bookmark the permalink.

One Response to Coldfusion SerializeJSON Function

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s