DecimalFormat and Serialization

Try this:

var a = 1;

dump(var=a, label="start") // a is number

a = DecimalFormat(1);

dump(var=a, label="after DecimalFormat") // a is string

dump( SerializeJSON(a) )  // a is treated as a string


Lucee: 5.4

@Roberto_Marzialetti i think the output is correct. The decimalFormat() function returns a string, not a float or decimal number. Thus, it will give you back a string representation with quotes in JSON. What is what you are doing with that value? Calculations? Then you won’t need decimals.