为什么有些字典键有引号而其他字典键在从调试器打印时没有? [英] Why do some dictionary keys have quotes and others don't when printing from debugger?
问题描述
所以我目前正从我的服务器发送一个JSON对象。如果我在XCode中打印responseObject,我会得到以下结果:
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;
}
为什么Order键不在中?这是唯一一个具有Number的键,我必须使用NumberFormatter从NSString转换为NSNumber。这是为什么?
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?
推荐答案
通常在字典控制台中没有任何引号的单个单词没有任何空格和其他特殊字符键。例如: - 上面示例中的键 order
和值 test
。这有助于保持可读性。将这些其他单词包含在引号中可确保可读性。
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.
这篇关于为什么有些字典键有引号而其他字典键在从调试器打印时没有?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!