Quantcast
Channel: Adobe Community: Message List - ColdFusion
Viewing all articles
Browse latest Browse all 21760

serializeJSON is converting ints to floats

$
0
0

CF10 update 11 Win7 x64

 

I'm running into a problem that I just noticed with serializeJSON()... ints are being converted to floats. Here's the code:

 

<cfset r = {

    "x": 0,

    "y": 1

}>

 

<cfoutput><pre>#serializeJSON(r)#</pre></cfoutput>

 

<cfset r.x = int(Val("1"))>

<cfset r.y = ceiling(100/10)>

 

<cfoutput><pre>#serializeJSON(r)#</pre></cfoutput>

 

Here's the output:

 

{"y":1,"x":0}

{"y":10.0,"x":1.0}

 

Is this messed up or what?


Viewing all articles
Browse latest Browse all 21760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>