问题
I have a strange issue which has started happening with SerializeJSON
, it's outputting the JSON with a comment at the beginning and I have no idea why. I've setup this test case:
<!--- initialize variables --->
<cfset records = QueryNew('') />
<!--- create property bean --->
<cfscript>
output = SerializeJSON(records);
</cfscript>
<cfdump var="#records#">
<cfdump var="#output#">
Which outputs:
//{"COLUMNS":[],"DATA":[]}
Is this familiar to anyone?
SOLVED
Found the issue. The cause was setting <cfset THIS.secureJSON = true>
in my Application.cfc. Setting it to false resolved the issue.
来源:https://stackoverflow.com/questions/17146365/coldfusion-8-serializejson-outputting-with-a-comment