I'm using NSJSONSerialization
to convert a dictionary into JSON.
If I include an NSDecimalNumber ( == 0 ) in that dictionary it outputs as 0
. This is wrong. 0
is an int. I need it to output as 0.0
.
This is what I'm doing:
NSDecimalNumber *decimal = [[NSDecimalNumber alloc] initWithFloat:0.0f];
// when fed into NSJSONSerialization it outputs as 0
Is there any way to output as 0.0
?
OR am I incorrect in my assumption? Is 0
a valid float?