How can I ch开发者_StackOverfloweck if a field exists?
Depends on how you get your return value, I'll assume it's a dictionary here, so you'll call
NSDictionary* json = [parser objectWithString:yourString error: nil];
Where yourString is the JSON string to parse, and parser is your SBJSON* object. This just gives you a dictionary, so you handle it the normal way, to test if a field named "blah" exists:
if ([json objectForKey:@"blah"] != nil)
See the reference material for NSDictionary for more information, it's just a normal dictionary object.
精彩评论