ios double quotes on dictionary when decimal point added

前端 未结 2 449
耶瑟儿~
耶瑟儿~ 2021-01-16 01:09

Im interacting with JSON, for \"get\" it works ok,

But with the \"post\", I have an error as the dictionary objects are surrounded with double quotes \"\"

an

相关标签:
2条回答
  • 2021-01-16 01:31

    Try using NSNumber to save your value for the key. Something like-

    [dicto setObject:[NSNumber numberWithDouble:10723.01] forKey:@"TransmissionAreaId"];
    
    0 讨论(0)
  • 2021-01-16 01:45

    Whatever the value you display in NSLog, it displays the value as string. Its a nature of NSLog that it adds double-quotes(") around the values if they contain special characters other than alphanumeric values.

    NSLog does this when it displays objects such as arrays and dictionaries. So, you won't see this behavior when you print just a string or float value directly in NSLog.

    And, you have nothing to do with that than stop worrying!

    0 讨论(0)
提交回复
热议问题