Why do some dictionary keys have quotes and others don't when printing from debugger?

回眸只為那壹抹淺笑 提交于 2019-12-07 08:25:40

问题


So I am currently sending back from my server a JSON object. If I do a print of the responseObject in XCode, I get the following:

Printing description of responseObject:
{
order = 3;
"picture_bucket_name" = test;
"picture_creation_date" = "2013-01-06T21:49:54.546Z";
"picture_identifier" = 61;
"picture_url_with_bucket" = "test/pictures/sop/steps/test_default_320_320.png";
"sub_order" = 0;
 }

Why is the Order key not in " "? This is the only key with a Number that I have to convert from NSString to NSNumber using a NumberFormatter. Why is that?


回答1:


Normally a single word without any spaces and other special characters are shown without any quotes in console for the dictionary key. For eg:- the key order and the value test in above example. That is helpful for maintaining the readability. Wrapping these other words in quotes ensure the readability.



来源:https://stackoverflow.com/questions/14187201/why-do-some-dictionary-keys-have-quotes-and-others-dont-when-printing-from-debu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!