ios - NSJSONSerialization output number as float? -
i'm using nsjsonserialization
convert dictionary json.
if include nsdecimalnumber ( == 0 ) in dictionary outputs 0
. wrong. 0
int. need output 0.0
.
this i'm doing:
nsdecimalnumber *decimal = [[nsdecimalnumber alloc] initwithfloat:0.0f]; // when fed nsjsonserialization outputs 0
is there way output 0.0
?
or incorrect in assumption? 0
valid float?
there no way affect way nsjsonserialization
outputs numbers. should not worry this. json doesn’t distinguish between different types of numbers, should accept numbers , without decimal points, no matter actual type of number doing calculations with.
Comments
Post a Comment