Solved

JSON serialization failure: Unable to serialize binary data to JSON

Posted on 2012-04-08
2
1,385 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 

Author Comment

by:ShanghaiD
ID: 37820736
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
ID: 37820740
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

635 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