Not sure whether the issue here is Lucee or Undertow or maybe something else.
I am making a call to a remote function in a CFC.
`
function getReport(type) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
periodType = type;
alert(this.responseText);
alert(typeof this.responseText);
var graphObj = JSON.parse(this.responseText);
alert(typeof graphObj);
if (graphObj.hasOwnProperty(“RETSTATUS”))
{
document.getElementById(‘errorMessage1’).innerHTML = ‘
’ + graphObj.RETSTATUS + ‘: |
’ + graphObj.RETMESSAGE + ’ |
’ + graphObj.RETEXTRATEXT + ‘ |
} else {
updateLineChart(graphObj, type);
updatePieChart(graphObj, type);
updateBarChart(graphObj, type);
updateReportTable(graphObj);
document.getElementById(‘errorMessage1’).innerHTML = ‘’;
}
}
};
xhttp.open(“GET”, “…/pathto.cfc?method=getReport&type=” + type + “&endDateTime=” + document.getElementById(‘endDate’).value + “&id=” + new Date().getTime(), true);
xhttp.setRequestHeader(“Content-Type”, “application/json”);
xhttp.send();
}
`
On Adobe I get back something like this from the three alerts:
{"TOTAL":{"AMOUNT":5318.51,"COUNT":43.0},"AMOUNT":[2.31,0.00,97.64,0.00,18.18,4.16,0.00,2255.66,2.21,2930.26,8.09],"LABEL":["May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","Jan","Feb","Mar"],"COUNT":[1,0,12,0,6,1,0,7,1,10,5]} string object
Just what I would expect.
But using Lucee on commandbox I get back a string with surrounding quotes and escaped double quotes:
`
“{“COUNT”:[2],“TOTAL”:{“COUNT”:2,“AMOUNT”:1.86},“LABEL”:[2016],“AMOUNT”:[1.86]}”
string
string
`
And the resulting string does not get parsed into a java object.
Any idea what is going on here?