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 <st...@cfcentral.com.au> 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 cfaussie@googlegroups.com.
> To unsubscribe from this group, send email to
> cfaussie+unsubscr...@googlegroups.com.
> 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 cfaussie@googlegroups.com.
To unsubscribe from this group, send email to 
cfaussie+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en.

Reply via email to