Solved

JSON serialization failure: Unable to serialize binary data to JSON

Posted on 2012-04-08
2
1,335 Views
Last Modified: 2012-04-08
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
Comment
Question by:ShanghaiD
  • 2
2 Comments
 

Author Comment

by:ShanghaiD
Comment Utility
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
 

Accepted Solution

by:
ShanghaiD earned 0 total points
Comment Utility
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now