Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1427
  • Last Modified:

JSON serialization failure: Unable to serialize binary data to JSON

I have a simple CFQUERY in a CFC which gets data from a mySQL table.  I'm using getJSON to load the data into my CFML page.  

My first attempt was wholly successful, but I have now added a new column into the mySQL query and after doing this, I now get an error: "JSON serialization failure: Unable to serialize binary data to JSON".

The new column I added to my CFQUERY is:
CONCAT(CASE WHEN H2HrefNo < 10 THEN '000' WHEN H2HrefNo < 100 THEN '00' WHEN H2HrefNo < 1000 THEN '0' ELSE '' END, H2HrefNo, '.jpg') AS filename,

All this is trying to do is to give a jpg file name in the format of something like: 0001.jpg, 0012.jpg, 0134.jpg,  etc -- forcing four digits regardless of actual H2HrefNo value (1 or 12 or 134 etc).

I've tried to see what is going wrong with Firebug but without success.  Any suggestions to fix my JSON serialisation failure would be appreciated.
0
ShanghaiD
Asked:
ShanghaiD
  • 2
1 Solution
 
ShanghaiDAuthor Commented:
I've simplified my SQL for the new column as:
RIGHT(CONCAT('000', H2HrefNo, '.jpg'),8) AS filename,
which gives the same mySQL result as the earlier syntax, but this still gives me the same JSON serialization failure error.
0
 
ShanghaiDAuthor Commented:
I've found a solution by changing the SQL syntax to:
CAST(RIGHT(CONCAT('000', H2HrefNo, '.jpg'),8)  AS CHAR) AS filename,
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now