SerializeJSON break upgrade from lucee 5.0.1.85 to 5.2.1.9 (and even to 5.1.0.34)

Hi,
I am developping using the docker image of lucee so the current lastversion of it is with lucee 5.0.1.85 but my production is uptodate : 5.2.1.9
And I came accross a weird comportement for SerializeJSON with THE SAME CODE : on the old version output this :

[[1531922462000,25.25],[1531923684000,25.25],[1531924284000,25.25],[1531924884000,25.25],[1531925484000,25.25],[1531926084000,25.25],[1531926684000,25.25],[1531927284000,25.25],[1531927885000,25.25],[1531928485000,25.25],[1531929085000,25.37],[1531929686000,25.37],[1531930286000,25.37],[1531930887000,25.37],[1531931488000,25.37],[1531932692000,25.37],[1531933292000,25.5],[1531933892000,25.5],[1531934491000,25.5],[1531935092000,25.5],[1531935692000,25.62],[1531936292000,25.62],[1531936892000,25.62],[1531937492000,25.62],[1531938092000,25.62],[1531938692000,25.62],[1531939293000,25.75],[1531939893000,25.75],[1531940493000,25.75],[1531941095000,25.75],[1531941698000,25.75],[1531942913000,25.75],[1531943513000,25.88],[1531944113000,25.88],[1531944713000,25.88],[1531945313000,25.88],[1531945913000,25.88],[1531946513000,25.88],[1531947113000,25.88],[1531947713000,26],[1531948314000,26],[1531948914000,26],[1531949514000,26],[1531950114000,26],[1531950714000,26],[1531951941000,26],[1531952541000,26],[1531953141000,26],[1531953741000,26],[1531954341000,26],[1531954941000,26],[1531955541000,26],[1531956141000,26],[1531956741000,26],[1531957341000,26],[1531957941000,26],[1531958541000,26],[1531959141000,26],[1531959741000,26],[1531960341000,26],[1531960942000,26],[1531961542000,26],[1531962142000,26],[1531962742000,26],[1531963342000,26],[1531963942000,26],[1531964542000,26],[1531965142000,26],[1531965742000,26],[1531966342000,26],[1531966942000,26],[1531967543000,26],[1531968142000,26],[1531968742000,26],[1531969342000,26],[1531969942000,26],[1531970542000,26],[1531971142000,26],[1531971742000,26],[1531972342000,26],[1531972942000,26],[1531973609000,26],[1531974209000,26],[1531974810000,26],[1531975410000,26],[1531976010000,26],[1531976610000,26],[1531977210000,26],[1531977810000,25.88],[1531978410000,25.88],[1531979010000,25.88],[1531979610000,25.88],[1531980210000,25.88],[1531980810000,25.88],[1531981410000,25.88],[1531982010000,25.88],[1531982610000,25.88],[1531983210000,25.88],[1531983810000,25.88],[1531984410000,25.88],[1531985010000,25.88],[1531985610000,25.88],[1531986210000,25.88],[1531986810000,25.88],[1531987410000,25.88],[1531988010000,25.88],[1531988610000,25.88],[1531989210000,25.88],[1531989810000,25.88],[1531990410000,25.88],[1531991010000,25.88],[1531991610000,25.88],[1531992211000,25.88],[1531992819000,25.88],[1531993419000,25.88],[1531994019000,25.88],[1531994619000,25.88],[1531995219000,25.88],[1531995826000,25.88],[1531996426000,25.88],[1531997026000,25.88],[1531997626000,25.88],[1531998226000,25.88],[1531998826000,25.88],[1531999426000,25.88],[1532000026000,25.88],[1532000626000,25.88],[1532001226000,25.88],[1532001826000,25.88],[1532002426000,25.88],[1532003026000,25.88],[1532003626000,25.88],[1532004226000,25.88],[1532006107000,26],[1532006707000,26],[1532007310000,26],[1532008526000,26]]

and on the new version output this :

[{"NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"NameAsString":"DATETIME","Name":"DATETIME","Value":1531928485000},{"NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"NameAsString":"Temp","Name":"Temp","Value":25.25}],[{"NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"NameAsString":"DATETIME","Name":"DATETIME","Value":1531929085000},{"NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"NameAsString":"Temp","Name":"Temp","Value":25.37}],[{"NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"NameAsString":"DATETIME","Name":"DATETIME","Value":1531929686000},{"NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"NameAsString":"Temp","Name":"Temp","Value":25.37}],[{"NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"NameAsString":"DATETIME","Name":"DATETIME","Value":1531930286000},{"NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"NameAsString":"Temp","Name":"Temp","Value":25.37}],[{"NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"NameAsString":"DATETIME","Name":"DATETIME","Value":1531930887000},{"NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"NameAsString":"Temp","Name":"Temp","Value":25.37}],[{"NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"NameAsString":"DATETIME","Name":"DATETIME","Value":1531931488000},{"NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"NameAsString":"Temp","Name":"Temp","Value":25.37}],[{"NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"NameAsString":"DATETIME","Name":"DATETIME","Value":1531932692000},{"NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"NameAsString":"Temp","Name":"Temp","Value":25.37}],[{"NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"NameAsString":"DATETIME","Name":"DATETIME","Value":1531933292000},{"NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"NameAsString":"Temp","Name":"Temp","Value":25.5}],[{"NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"NameAsString":"DATETIME","Name":"DATETIME","Value":1531933892000},{"NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"NameAsString":"Temp","Name":"Temp","Value":25.5}],[{"NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"NameAsString":"DATETIME","Name":"DATETIME","Value":1531934491000},{"NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"NameAsString":"Temp","Name":"Temp","Value":25.5}],[{"NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"NameAsString":"DATETIME","Name":"DATETIME","Value":1531935092000},{"NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"NameAsString":"Temp","Name":"Temp","Value":25.5}],[{"NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"NameAsString":"DATETIME","Name":"DATETIME","Value":1531935692000},{"NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"NameAsString":"Temp","Name":"Temp","Value":25.62}],[{"NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"NameAsString":"DATETIME","Name":"DATETIME","Value":1531936292000},{"NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"NameAsString":"Temp","Name":"Temp","Value":25.62}],[{"NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"NameAsString":"DATETIME","Name":"DATETIME","Value":1531936892000},{"NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"NameAsString":"Temp","Name":"Temp","Value":25.62}] ....

the array from what is works is of the form :

Array
Rows: 138
1	
Array
1	
number	1531928485000
2	
number	25.25
2	
Array
1	
number	1531929085000
2	
number	25.37
3	
Array
1	
number	1531929686000
2	
number	25.37

where those NameAsKey or NameAsString are coming from ??

Thanks for your help !

Stéphane

I’m not quite following. Can you please provide a stand alone code block that we can copy paste and run to view this behavior?

here it is :

<cfset datatexte='{"Name":"THE_NAME_VALUE","KEYNAME": [{"SUBKEY":"SUBKEYVALUE","DATAS":[["DATETIME": 1532018759000, "Temp": 27.25],["DATETIME": 1532019359000, "Temp": 27.25],["DATETIME": 1532019959000, "Temp": 27.5],["DATETIME": 1532020563000, "Temp": 27.75],["DATETIME": 1532021162000, "Temp": 27.5],["DATETIME": 1532021763000, "Temp": 27.75],["DATETIME": 1532022362000, "Temp": 27.62],["DATETIME": 1532022965000, "Temp": 27.37],["DATETIME": 1532023564000, "Temp": 27],["DATETIME": 1532024164000, "Temp": 27],["DATETIME": 1532024765000, "Temp": 26.5],["DATETIME": 1532025365000, "Temp": 26.37],["DATETIME": 1532025964000, "Temp": 26.25],["DATETIME": 1532026570000, "Temp": 26.25],["DATETIME": 1532028395000, "Temp": 25.75],["DATETIME": 1532028996000, "Temp": 25.75],["DATETIME": 1532029596000, "Temp": 25.75],["DATETIME": 1532030196000, "Temp": 25.5],["DATETIME": 1532030796000, "Temp": 25.5],["DATETIME": 1532031396000, "Temp": 25.37],["DATETIME": 1532031996000, "Temp": 25.37],["DATETIME": 1532033214000, "Temp": 25.25],["DATETIME": 1532033813000, "Temp": 25.25],["DATETIME": 1532034413000, "Temp": 25.12],["DATETIME": 1532035013000, "Temp": 25.12],["DATETIME": 1532035613000, "Temp": 25],["DATETIME": 1532036214000, "Temp": 25],["DATETIME": 1532036813000, "Temp": 25],["DATETIME": 1532037413000, "Temp": 24.87],["DATETIME": 1532038014000, "Temp": 24.75],["DATETIME": 1532038613000, "Temp": 24.63],["DATETIME": 1532039214000, "Temp": 24.63],["DATETIME": 1532039814000, "Temp": 25.12],["DATETIME": 1532040413000, "Temp": 25.37],["DATETIME": 1532041013000, "Temp": 25.37],["DATETIME": 1532041613000, "Temp": 25.5],["DATETIME": 1532042831000, "Temp": 25.62],["DATETIME": 1532043431000, "Temp": 25.62],["DATETIME": 1532044031000, "Temp": 25.75],["DATETIME": 1532044631000, "Temp": 25.75]]}]}'>

<cfset data = deserializeJSON(datatexte)>

<cfdump var="#data#" label="data" expand="false">
<cfdump var="#data.KEYNAME[1].DATAS#" label="data sonde 1" expand="false">

<cfset json=serializeJSON(data.KEYNAME[1].DATAS)>

<cfdump var="#json#" label="json" expand="false">

on the old version of Lucee I get :

[[1532018759000,27.25],[1532019359000,27.25],[1532019959000,27.5],[1532020563000,27.75],[1532021162000,27.5],[1532021763000,27.75],[1532022362000,27.62],[1532022965000,27.37],[1532023564000,27],[1532024164000,27],[1532024765000,26.5],[1532025365000,26.37],[1532025964000,26.25],[1532026570000,26.25],[1532028395000,25.75],[1532028996000,25.75],[1532029596000,25.75],[1532030196000,25.5],[1532030796000,25.5],[1532031396000,25.37],[1532031996000,25.37],[1532033214000,25.25],[1532033813000,25.25],[1532034413000,25.12],[1532035013000,25.12],[1532035613000,25],[1532036214000,25],[1532036813000,25],[1532037413000,24.87],[1532038014000,24.75],[1532038613000,24.63],[1532039214000,24.63],[1532039814000,25.12],[1532040413000,25.37],[1532041013000,25.37],[1532041613000,25.5],[1532042831000,25.62],[1532043431000,25.62],[1532044031000,25.75],[1532044631000,25.75]]

on the new version of lucee I get :

[[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532018759000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":27.25}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532019359000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":27.25}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532019959000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":27.5}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532020563000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":27.75}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532021162000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":27.5}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532021763000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":27.75}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532022362000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":27.62}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532022965000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":27.37}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532023564000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":27}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532024164000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":27}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532024765000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":26.5}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532025365000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":26.37}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532025964000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":26.25}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532026570000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":26.25}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532028395000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":25.75}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532028996000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":25.75}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532029596000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":25.75}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532030196000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":25.5}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532030796000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":25.5}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532031396000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":25.37}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532031996000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":25.37}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532033214000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":25.25}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532033813000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":25.25}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532034413000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":25.12}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532035013000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":25.12}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532035613000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":25}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532036214000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":25}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532036813000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":25}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532037413000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":24.87}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532038014000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":24.75}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532038613000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":24.63}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532039214000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":24.63}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532039814000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":25.12}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532040413000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":25.37}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532041013000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":25.37}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532041613000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":25.5}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532042831000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":25.62}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532043431000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":25.62}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532044031000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":25.75}],[{"NameAsString":"DATETIME","NameAsKey":{"LowerString":"datetime","UpperString":"DATETIME","String":"DATETIME"},"Name":"DATETIME","Value":1532044631000},{"NameAsString":"Temp","NameAsKey":{"LowerString":"temp","UpperString":"TEMP","String":"Temp"},"Name":"Temp","Value":25.75}]]

Thanks for your help !!

Stéphane

Ahh, I see. Why are you mixing array and struct notation here:

 [  
       "DATETIME":1532018759000,
       "Temp":27.25
]

I’m pretty sure that’s not even valid JSON. IMO this should actually throw an error. The fact that it’s “working” is most likely an accident and what’s happening in Lucee 5 is you’re just getting some internal variables dumped out on accident. Can you put in a ticket that states that Lucee is allowing invalid JSON instead of throwing an exception?

this syntax is supported because CFML script does support (ordered struct), but i agree should not work with json.

I am trying to get as close as possible of this highcharts graph :
https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/demo/spline-irregular-time/

data is of that form :

data: [
            [Date.UTC(1970, 10, 25), 0],
            [Date.UTC(1970, 11,  6), 0.25],
            [Date.UTC(1970, 11, 20), 1.41],
            [Date.UTC(1970, 11, 25), 1.64]
]

not sure why this wouldn’t be plain json … (I am not too great at json :wink: )

That is nothing like the first snippet you posted. We said your first snippet isn’t valid JSON. The second snippet is an array of arrays. However, I’m not aware of anything to the tune of Date.UTC() in the JSON spec, even though that might be something that JavaScript itself would execute if you were to run it through JS’s eval() function.

You can read a simple and image-based overview of what is valid JSON here: http://json.org/

I am sorry but I don’t get it …
How my json should look to be “ok” ? and that I could extract that form :

[[1532018759000,27.25],[1532019359000,27.25],[1532019959000,27.5],[1532020563000,27.75],[1532021162000,27.5],[1532021763000,27.75],[1532022362000,27.62],[1532022965000,27.37],[1532023564000,27],[1532024164000,27],[1532024765000,26.5],[1532025365000,26.37],[1532025964000,26.25],[1532026570000,26.25],[1532028395000,25.75],[1532028996000,25.75],[1532029596000,25.75],[1532030196000,25.5],[1532030796000,25.5],[1532031396000,25.37],[1532031996000,25.37],[1532033214000,25.25],[1532033813000,25.25],[1532034413000,25.12],[1532035013000,25.12],[1532035613000,25],[1532036214000,25],[1532036813000,25],[1532037413000,24.87],[1532038014000,24.75],[1532038613000,24.63],[1532039214000,24.63],[1532039814000,25.12],[1532040413000,25.37],[1532041013000,25.37],[1532041613000,25.5],[1532042831000,25.62],[1532043431000,25.62],[1532044031000,25.75],[1532044631000,25.75]]

The url you gave me, make me think (but I am not english first language so I may be wrong) that I could use an array of pair … which I though I was doing …
In fact I still don’t see my mistake …

Stéphane

Not sure where is the problem. I created a script with the following code and it seems to work fine:

<cfscript>

data = [[1531922462000,25.25],[1531923684000,25.25],[1531924284000,25.25],[1531924884000,25.25],[1531925484000,25.25],[1531926084000,25.25],[1531926684000,25.25],[1531927284000,25.25],[1531927885000,25.25],[1531928485000,25.25],[1531929085000,25.37],[1531929686000,25.37],[1531930286000,25.37],[1531930887000,25.37],[1531931488000,25.37],[1531932692000,25.37],[1531933292000,25.5],[1531933892000,25.5],[1531934491000,25.5],[1531935092000,25.5],[1531935692000,25.62],[1531936292000,25.62],[1531936892000,25.62],[1531937492000,25.62],[1531938092000,25.62],[1531938692000,25.62],[1531939293000,25.75],[1531939893000,25.75],[1531940493000,25.75],[1531941095000,25.75],[1531941698000,25.75],[1531942913000,25.75],[1531943513000,25.88],[1531944113000,25.88],[1531944713000,25.88],[1531945313000,25.88],[1531945913000,25.88],[1531946513000,25.88],[1531947113000,25.88],[1531947713000,26],[1531948314000,26],[1531948914000,26],[1531949514000,26],[1531950114000,26],[1531950714000,26],[1531951941000,26],[1531952541000,26],[1531953141000,26],[1531953741000,26],[1531954341000,26],[1531954941000,26],[1531955541000,26],[1531956141000,26],[1531956741000,26],[1531957341000,26],[1531957941000,26],[1531958541000,26],[1531959141000,26],[1531959741000,26],[1531960341000,26],[1531960942000,26],[1531961542000,26],[1531962142000,26],[1531962742000,26],[1531963342000,26],[1531963942000,26],[1531964542000,26],[1531965142000,26],[1531965742000,26],[1531966342000,26],[1531966942000,26],[1531967543000,26],[1531968142000,26],[1531968742000,26],[1531969342000,26],[1531969942000,26],[1531970542000,26],[1531971142000,26],[1531971742000,26],[1531972342000,26],[1531972942000,26],[1531973609000,26],[1531974209000,26],[1531974810000,26],[1531975410000,26],[1531976010000,26],[1531976610000,26],[1531977210000,26],[1531977810000,25.88],[1531978410000,25.88],[1531979010000,25.88],[1531979610000,25.88],[1531980210000,25.88],[1531980810000,25.88],[1531981410000,25.88],[1531982010000,25.88],[1531982610000,25.88],[1531983210000,25.88],[1531983810000,25.88],[1531984410000,25.88],[1531985010000,25.88],[1531985610000,25.88],[1531986210000,25.88],[1531986810000,25.88],[1531987410000,25.88],[1531988010000,25.88],[1531988610000,25.88],[1531989210000,25.88],[1531989810000,25.88],[1531990410000,25.88],[1531991010000,25.88],[1531991610000,25.88],[1531992211000,25.88],[1531992819000,25.88],[1531993419000,25.88],[1531994019000,25.88],[1531994619000,25.88],[1531995219000,25.88],[1531995826000,25.88],[1531996426000,25.88],[1531997026000,25.88],[1531997626000,25.88],[1531998226000,25.88],[1531998826000,25.88],[1531999426000,25.88],[1532000026000,25.88],[1532000626000,25.88],[1532001226000,25.88],[1532001826000,25.88],[1532002426000,25.88],[1532003026000,25.88],[1532003626000,25.88],[1532004226000,25.88],[1532006107000,26],[1532006707000,26],[1532007310000,26],[1532008526000,26]];

writeDump(serializeJson(data));

</cfscript>

See https://trycf.com/gist/6cd16c9f6c2e5ea18f4c46c631098bbb/lucee5?theme=monokai

The output I get is:

[[1531922462000,25.25],[1531923684000,25.25],[1531924284000,25.25],[1531924884000,25.25],[1531925484000,25.25],[1531926084000,25.25],[1531926684000,25.25],[1531927284000,25.25],[1531927885000,25.25],[1531928485000,25.25],[1531929085000,25.37],[1531929686000,25.37],[1531930286000,25.37],[1531930887000,25.37],[1531931488000,25.37],[1531932692000,25.37],[1531933292000,25.5],[1531933892000,25.5],[1531934491000,25.5],[1531935092000,25.5],[1531935692000,25.62],[1531936292000,25.62],[1531936892000,25.62],[1531937492000,25.62],[1531938092000,25.62],[1531938692000,25.62],[1531939293000,25.75],[1531939893000,25.75],[1531940493000,25.75],[1531941095000,25.75],[1531941698000,25.75],[1531942913000,25.75],[1531943513000,25.88],[1531944113000,25.88],[1531944713000,25.88],[1531945313000,25.88],[1531945913000,25.88],[1531946513000,25.88],[1531947113000,25.88],[1531947713000,26],[1531948314000,26],[1531948914000,26],[1531949514000,26],[1531950114000,26],[1531950714000,26],[1531951941000,26],[1531952541000,26],[1531953141000,26],[1531953741000,26],[1531954341000,26],[1531954941000,26],[1531955541000,26],[1531956141000,26],[1531956741000,26],[1531957341000,26],[1531957941000,26],[1531958541000,26],[1531959141000,26],[1531959741000,26],[1531960341000,26],[1531960942000,26],[1531961542000,26],[1531962142000,26],[1531962742000,26],[1531963342000,26],[1531963942000,26],[1531964542000,26],[1531965142000,26],[1531965742000,26],[1531966342000,26],[1531966942000,26],[1531967543000,26],[1531968142000,26],[1531968742000,26],[1531969342000,26],[1531969942000,26],[1531970542000,26],[1531971142000,26],[1531971742000,26],[1531972342000,26],[1531972942000,26],[1531973609000,26],[1531974209000,26],[1531974810000,26],[1531975410000,26],[1531976010000,26],[1531976610000,26],[1531977210000,26],[1531977810000,25.88],[1531978410000,25.88],[1531979010000,25.88],[1531979610000,25.88],[1531980210000,25.88],[1531980810000,25.88],[1531981410000,25.88],[1531982010000,25.88],[1531982610000,25.88],[1531983210000,25.88],[1531983810000,25.88],[1531984410000,25.88],[1531985010000,25.88],[1531985610000,25.88],[1531986210000,25.88],[1531986810000,25.88],[1531987410000,25.88],[1531988010000,25.88],[1531988610000,25.88],[1531989210000,25.88],[1531989810000,25.88],[1531990410000,25.88],[1531991010000,25.88],[1531991610000,25.88],[1531992211000,25.88],[1531992819000,25.88],[1531993419000,25.88],[1531994019000,25.88],[1531994619000,25.88],[1531995219000,25.88],[1531995826000,25.88],[1531996426000,25.88],[1531997026000,25.88],[1531997626000,25.88],[1531998226000,25.88],[1531998826000,25.88],[1531999426000,25.88],[1532000026000,25.88],[1532000626000,25.88],[1532001226000,25.88],[1532001826000,25.88],[1532002426000,25.88],[1532003026000,25.88],[1532003626000,25.88],[1532004226000,25.88],[1532006107000,26],[1532006707000,26],[1532007310000,26],[1532008526000,26]]

No, you’re right. There is a problem here.

If you need a quick workaround for now, you can use this:

<cfset datas = data.KEYNAME[1].DATAS>
<cfset json = serializeJSON( datas.map( function(el, ix){ return [ el[1].value, el[2].value ]; } ))>

But please open a ticket in JIRA.

Lucee 5.x

works differently from

Lucee 4.5

JSON is a well known and oft-used data format that Lucee or even ColdFusion didn’t invent. If you’re asking what makes valid JSON… valid, I’m not sure this forum is a good place to try and teach the breadth of the JSON spec. It’s pretty straight forward though and I would encourage you to read up on documentation such as the link I posted above to familiarize yourself with JSON.

Here’s an overview of the most common data types that it supports:

{
  "myString" : "I like spam",
  "myNumber" : 42,
  "myBoolean" : true,
  "myObject" : {
    "key1" : "value1",
    "key2" : "value2"
  },
  "myArray" : [
    "index1",
    "index2",
    "index3"
  ],
}

You will notice that square brackets [] are used to represent an ordered collected of unnamed elements, while curly braces {} are used to represent key/value pairs of a collection. You can mix and match these data types as you see fit, nesting them in any way you wish, but you’ll noticed that you cannot use key/value pairs in an array. That is not valid JSON.

The fact that Lucee did not throw an exception when you gave it invalid JSON was a bug in Lucee that needs fixed.

Thank you, that’s pretty clear, but that mean that the array of pair used by highcharts is not valid json … I was pretty convinced that there were really good on the json spec …

because this :

data: [
            [Date.UTC(1970, 10, 25), 0],
            [Date.UTC(1970, 11,  6), 0.25],
            [Date.UTC(1970, 11, 20), 1.41],
            [Date.UTC(1970, 11, 25), 1.64]
]

and this

[[1532018759000,27.25],[1532019359000,27.25],[1532019959000,27.5],[1532020563000,27.75],[1532021162000,27.5],[1532021763000,27.75],[1532022362000,27.62],[1532022965000,27.37],[1532023564000,27],[1532024164000,27],[1532024765000,26.5],[1532025365000,26.37],[1532025964000,26.25],[1532026570000,26.25],[1532028395000,25.75],[1532028996000,25.75],[1532029596000,25.75],[1532030196000,25.5],[1532030796000,25.5],[1532031396000,25.37],[1532031996000,25.37],[1532033214000,25.25],[1532033813000,25.25],[1532034413000,25.12],[1532035013000,25.12],[1532035613000,25],[1532036214000,25],[1532036813000,25],[1532037413000,24.87],[1532038014000,24.75],[1532038613000,24.63],[1532039214000,24.63],[1532039814000,25.12],[1532040413000,25.37],[1532041013000,25.37],[1532041613000,25.5],[1532042831000,25.62],[1532043431000,25.62],[1532044031000,25.75],[1532044631000,25.75]]

are the same, js is converting DATE to UNIXTIMESTAMP

I will use isapir workaround for now !

Thanks for your help.

Stéphane

Thanks for your help,
I think that they are right about the fact that array of key/value is not correct in json so this bring to a whole problem between being compliant with json or being stable between releases, or even with highcharts using wrong json form (but here, I do think it’s my bad and not there) …
I will use your workaround and also check if an array of object with key value, is ok or not.

Thanks again !
Stéphane

@pilere An easy way to check for the value is with the ?: (elvis) operator. The following snippet will work both on Lucee 4.5 and 5.2:

<cfset json = serializeJSON( 
    datas.map( 
        function(el, ix){ 
            return [ el[1].value ?: el[1], el[2].value ?: el[2] ]; 
        } 
    )
)>