ColdFusion, CFHTTP, and

This post is more than 2 years old.

I believe I may have blogged this before, but a reader ran into this yesterday so I thought it might be worth sharing. If you are using CFHTTP to hit a remote and seeing in the result, there is a simple solution around that.

Here is a sample cfdump of just such a response. You are expecting a string of some sort in fileContent, but instead end up with a Java object:


To work with this result as a string, you simply need to run toString() on the value. So for example, if you know the response is JSON:


I'll be honest and say I don't know why some servers return that, or why cfhttp can't simply toString it itself. I'm assuming there is a good reason that probably involves all kind of crap I really don't care about. ;)

p.s. It looks like this might be just ColdFusion 9 and earlier - see this bug report. I can say it has been a while since I've seen it. I've run ColdFusion 10 since it came out pretty much.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate for HERE Technologies. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA