Non-string key in NSDictionary object?

后端 未结 2 1913
予麋鹿
予麋鹿 2021-01-24 15:54

I\'ve parsed some JSON data using NSJSONSerialization from the Foundation framework - however, I\'m getting a weird key for an NSDictionary group as follows

\"st         


        
2条回答
  •  迷失自我
    2021-01-24 16:33

    The description method of NSDictionary (which is used if you output a dictionary with NSLog, or print it in the debugger) encloses strings in quotation marks only if they contain special characters.

    This output format is described in Old-Style ASCII Property Lists in the "Property List Programming Guide":

    The quotation marks can be omitted if the string is composed strictly of alphanumeric characters and contains no white space (numbers are handled as strings in property lists). ...

    Note that in general you cannot deduce the type from the NSLog() output. 123 can be a number or a string. But in this case, shape can only be a string.

提交回复
热议问题