I am making an awesome iPhone app that searches for YouTube videos using the JSON API. However, Google is lazy, they just transformed the ATOM feed into JSON. Everything looks like this:
feed->entry[0]->author[0]->name->$t
This means that getting information from NSArray is difficult, since I need to get the key value of an array object of an object of an array of an object of a key.
To check the correctness of the structure, I can choose two things:
- Use a huge amount of code for each element that I want to check if JSON is correct.
- Wrap everything in a @try block.
I would choose the second. The problem is that some time ago I read that this is bad practice. It? And if so, is there a shorter way to validate NSArrays en NSDictionaries? My application can never crash, even if the user removes the processor at run time, so not checking at all is not an option.
Could you help me? Thank.
user142019
source
share