Why do some dictionary keys have quotes and others

2019-05-09 08:31发布

问题:

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.