Quick question:
How do I parse a NSString using SBJSON4 The string is an UTF-8 encoded JSON string from a web REST api. I need an NSDIctionary with the parsed data. The string is guaranteed to be a complete JSON document.
@interface NSOperationParseJSON ()
@property (weak, nonatomic) id<JSONParseDelegate> delegate;
@property (strong, nonatomic) NSString *stringToParse;
@property (strong, nonatomic) SBJson4Parser *jsonParser;
@end
@implementation NSOperationParseJSON
- (instancetype)initWithJSONString:(NSString *)jsonString andDelegate:(id<JSONParseDelegate>)delegate
{
self = [super init];
if (self) {
_delegate = delegate;
_stringToParse = jsonString;
_jsonParser = [[SBJson4Parser alloc] init];
}
return self;
}
#pragma mark - OVERRIDEN
- (void)main
{
@autoreleasepool {
if (self.isCancelled) {
return;
}
SBJson4ParserStatus responseCode = [self.jsonParser parse:[self.stringToParse dataUsingEncoding:NSUTF8StringEncoding]];
if (responseCode == SBJson4ParserComplete) {
} else if (SBJson4ParserError) {
}
}
}
Where do I get the response?