I get a JSON response, that contains an empty key (“”):
{
"errors": {
"": [
"Wrong email and password combination"
]
}
}
Can this JSON be properly parsed into NSDictionary using JSONKit?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If it were the data portion and you were using TouchJSON, it would typically get interpreted as null and set as an NSNull object in the dictionary rather than an NSString. (you can compare to [NSNull null]).
Not sure what happens with JSONKit or whether it being a key rather than a value would make any difference to this (I would assume not, but if its interpreted as NSNull key and there are multiple null keys this would I assume create some issues).
EDIT: Jason is correct with his comment below. NSNull is only set if there is a null value on the object – an empty string is set as an empty string in the dictionary. If the key value is an empty string then the dictionary has an object with a key of @”” (and it can be retrieved thus
[myDictionary objectForKey:@””];
Note this is all in TouchJSON