IOS-json File Analysis Methods: ios-json
1. Engineering Drawing.
Ii. Code.
# Import "ViewController. h"
# Import "SBJson. h"
@ Interface ViewController ()
@ End
@ Implementation ViewController
-(Void) viewDidLoad {
[Super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
// The first JSON parsing method is the built-in JSON parsing method.
NSString * datapath = [[NSBundle mainBundle] pathForResource: @ "failureReason" ofType: @ "json"];
NSData * jsonData = [NSData dataWithContentsOfFile: datapath];
NSMutableDictionary * arrayDic = [NSJSONSerialization JSONObjectWithData: jsonData options: NSJSONReadingMutableContainers error: nil];
NSLog (@ "---- arrayDic --- % @", arrayDic );
// SBJson Parsing
NSString * filePath = [[NSBundle mainBundle] pathForResource: @ "failureReason" ofType: @ "json"];
NSString * myJSON = [[NSString alloc] initWithContentsOfFile: filePath encoding: NSUTF8StringEncoding error: NULL];
NSDictionary * json = [myJSON JSONValue];
NSLog (@ "-- json -- % @", json );
}