NSJSONSeriarizeを用いる(iOS5から)

NSDictionary *d =  [NSJSONSerialization JSONObjectWithData:json_data options:NSJSONReadingAllowFragments error:&error];

enum {
  NSJSONReadingMutableContainers = (1UL << 0), //Specifies that arrays and dictionaries are created as mutable objects.
  NSJSONReadingMutableLeaves = (1UL << 1), //Specifies that leaf strings in the JSON object graph are created as instances of NSMutableString.
  NSJSONReadingAllowFragments = (1UL << 2) //Specifies that the parser should allow top-level objects that are not an instance of NSArray or NSDictionary. 
};
typedef NSUInteger NSJSONReadingOptions;


JSONフレームワークを用いる

最終更新:2012年06月22日 17:20