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 java.io.ByteArrayOutputStream 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.