Yeah it can be fixed with if/else but should it be? We want to write "less" code, not more...true ? or maybe it is YES J
From: Paul Kukiel [mailto:[email protected]] Sent: Thursday, 4 August 2011 5:13 PM To: [email protected] Subject: Re: [cfaussie] Converting boolean YES to true Its odd that !true is NO but cant you just use if/else to accomplish this till(if) Adobe fix this? Paul On Thu, Aug 4, 2011 at 5:04 PM, Steve Onnis <[email protected]> wrote: And that is dealing with the structures itself. I am dealing with single variables as per my example. No json conversion or anything. I want !true to give me false, not NO -----Original Message----- From: Zac Spitzer [mailto:[email protected]] Sent: Thursday, 4 August 2011 4:56 PM To: [email protected] Subject: Re: [cfaussie] Converting boolean YES to true It's an annoying bug in Adobe CF, Railo works as expected http://stackoverflow.com/questions/1867728/how-can-i-prevent-serializejson-f <http://stackoverflow.com/questions/1867728/how-can-i-prevent-serializejson- f%0d%0arom-changing-yes-no-true-false-strings-to-boolea/6661460#6661460> rom-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] <mailto:cfaussie%[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 <tel:%2B61%20405%20847%20168> -- 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] <mailto:cfaussie%[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] <mailto:cfaussie%[email protected]> . For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en. -- Paul Kukiel -- 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.
