TMJSON provides a safe and easy way to play with JSON, totally inspired by SwiftyJSON.
- iOS 7.0+
- Xcode 7
Just add pod 'TMJSON' to your Podfile.
Usage is quite similar to SwiftyJSON.
TMJSON *json = [[TMJSON alloc] initWithObject:responseObject];
NSArray *rootArray = json.arrayValue;
NSLog(@"array: %@", rootArray);
TMJSON *firstObject = rootArray[0];
NSString *wrongKey = firstObject[@"Teemo"].stringValue;
NSLog(@"wrongKey: %@", wrongKey);
NSString *name = firstObject[@"name"].stringValue;
NSLog(@"name: %@", name);
NSDictionary *address = firstObject[@"address"].dictionaryValue;
NSLog(@"address: %@", address);
double latitude = firstObject[@"address"][@"geo"][@"lat"].doubleValue;
NSLog(@"lat: %f", latitude);
TMJSON is available under the MIT license. See the LICENSE file for more info.