"Also can anyone one recommend a way to do this now? I tried JavaCast(“Boolean”, foo) but that didn’t work."
have you seen this? http://www.coldfusionmuse.com/index.cfm/2010/2/5/Booleans.and.Coldfusion Also, have you confirmed you have a true boolean? What I'm getting at is the difference between True/False/Null (tri-state) True/Absence of True (boolean) The last one is important because you just have to check to see if the value is there. these two CFLib functions may help http://cflib.org/udf/booleanize http://cflib.org/udf/forceBoolean On Thu, Aug 4, 2011 at 4:55 PM, Zac Spitzer <[email protected]> wrote: > It's an annoying bug in Adobe CF, Railo works as expected > > http://stackoverflow.com/questions/1867728/how-can-i-prevent-serializejson-from-changing-yes-no-true-false-strings-to-boolea/6661460#6661460 > > z > > On Thu, Aug 4, 2011 at 4:39 PM, Steve Onnis <[email protected]> wrote: >> I have been coming across this issue more and more when dealing with >> JavaScript and JSON which is ColdFusion changing true|false to YES|NO >> values. >> >> >> >> For example:- >> >> >> >> <cfset foo = true /> >> >> <cfoutput>#foo#</cfoutput> = true >> >> >> >> <cfset foo = !foo /> >> >> <cfoutput>#foo#</cfoutput> = NO >> >> >> >> Now take this JSON string for example >> >> >> >> {“foo”:#foo#} would then become {“foo”:NO} which then screws everything up >> >> >> >> I posted a feature request on the adobe site to have a toBoolean() function >> which would return only true or false based on the argument >> >> >> >> So then we would be able to have... >> >> >> >> {“foo”:#toBollean(foo)#} which would output as {“foo”:false} >> >> >> >> What are the thoughts here. I was very surprised to see the lack of this >> function in the library actually. >> >> >> >> Also can anyone one recommend a way to do this now? I tried >> JavaCast(“Boolean”, foo) but that didn’t work. >> >> >> >> Steve >> >> -- >> You received this message because you are subscribed to the Google Groups >> "cfaussie" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/cfaussie?hl=en. >> > > > > -- > Zac Spitzer > Solution Architect / Director > Ennoble Consultancy Australia > http://www.ennoble.com.au > http://zacster.blogspot.com > +61 405 847 168 > > -- > You received this message because you are subscribed to the Google Groups > "cfaussie" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/cfaussie?hl=en. > > -- You received this message because you are subscribed to the Google Groups "cfaussie" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en.
