cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Add boolean type in Flexscript and support it in JSON.stringify

Add boolean type in Flexscript and support it in JSON.stringify

Flexscript follows the C language convention of using numbers as booleans. This is fine for implementing all kind of logic, but it creates an ambiguity when the data has to be exchanged with other systems.

 

In Flexscript it seems to be impossible to generate JSON with boolean values, such as `true` and `false`, which are required by some 3rd party protocols. Conversion JSON.parse -> JSON.stringify is lossy.

 

I think this example explains the issue:

sastanin_0-1753087453712.png


I suppose that the issue can be resolved if Flexscript had a `bool`  type, similar to `int`, and it was also a distinct `Variant` type, so it can be stored as a binary flag within Maps and Arrays. This would allow JSON.stringify and similar methods to generate correct output.

Can't find what you're looking for? Ask the community or share your knowledge.

Submit Idea