Dave, The code testval = '.0006' makes me think a string instead of a number. Javacast might force a type on the string eh?
Brooke - are you looking for a number or a string? -Mark -----Original Message----- From: Dave Watts [mailto:dwa...@figleaf.com] Sent: Monday, August 05, 2013 7:52 PM To: cf-talk Subject: Re: JSON Encoding bug (again...) > I have had to do so many hacks to get serializeJSON() to play nice. I add a > "~" to all yes/no strings so I don't get back true/false values, I have a > series of regular expressions that quote values in the resulting JSON that > don't get quoted and break on the client side. And now I have this issue: > > <cfset x = {testval='.0006'}> > <cfdump var="#serializeJSON(x)#"> > > Which outputs: > > {"TESTVAL":6.0E-4} > > WTF? > > I am using CF 9,0,1,274733 > Update Level /C:/ColdFusion9/lib/updates/hf901-00004.jar > > Anybody know of a workaround for this? The source data is in a query which > gets serialized after being converted to an array of structs. It would be > too slow to check each field for values like this and modify them to return > to the client. I need another Idea. Anyone? This isn't really a problem with JSON serialization, but with CF being typeless, and CF's tendency to autoconvert numbers into scientific notation. You can work around this by using precisionEvaluate(), the BigDecimal version of the Evaluate function: <cfset x = {testval=precisionEvaluate(.0006)}> <cfdump var="#serializeJSON(x)#"> Note that this will add a leading zero. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356393 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm