I am deserializing some JSON using the TouchJSON
framework. The array of dictionaries that comes from the parsing is used to populate a UITableView
.
There is a chance that some of the values in the JSON I parse are empty. This results, if I NSLog
it to the console, in the values looking like this:
id = 1234;
title = "Hello, World";
description = "<null>";
detail = "The world says hello";
Here the description value was an empty string when retrieved from the server.
So TouchJSON recognizes that the description values is of type string, but the original intention of the server was to communicate that this was an empty string, like description = @"";
If I later on try to set the value of description, to a UILabels
text property the app will crash.
So my questions are, I have both NSNumbers and NSStrings in the JSON, should I traverse the result from TouchJSON's deserialize method and test all values and how would I do so?
I can't simulated what would happen if an NSNumber value was empty, how would I test for this? Will the NSNumber value be nil in that case instead of "null"?