다운 받는 곳 
https://github.com/johnezang/JSONKit

사용법

#import "JSONKit.h"

... 


NSString *filePath = [[NSBundle mainBundle] pathForResource:@"items" ofType:@"json"];   

NSString *a = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];

    

// 클래스의 종류 내용보기 

//    NSLog(@"class:%@ a:%@",[a class], a);

    

// JSON NSArray NSDictionary 변환 

NSArray *array = [a objectFromJSONString];

NSLog(@"class: %@, %d", [array class], [array count]);

    

// Array에서 Dictionary 가져오기 

NSDictionary *dic = [array objectAtIndex:0];

NSLog(@"dic name:%@", [[dic valueForKey:@"name"] description]);

 

'iOS' 카테고리의 다른 글

iOS에서 Document에 zip 파일을 넣어서 풀기  (0) 2012.05.16
Objective-C Outlet  (0) 2010.08.07
UIView Flip 효과 - iPhone  (0) 2010.06.29

+ Recent posts