title: Passing data from local file using json
body: <p>I am trying to pass data to labels from my JSON file onto a simple ViewController but I don't know where to actually pass that data. Would I be able to just add to my <code>setDataToJson</code> method or would I add the data in my <code>viewDidLoad</code> method?</p>
  
  <p>here is my code</p>
  
  <pre><code>@interface NSDictionary(JSONCategories)
  +(NSDictionary*)dictionaryWithContentsOfJSONString:(NSString*)fileLocation;
  @end
  
  @implementation NSDictionary(JSONCategories)
  
  +(NSDictionary*)dictionaryWithContentsOfJSONString:(NSString*)fileLocation{
      NSData* data = [NSData dataWithContentsOfFile:fileLocation];
      __autoreleasing NSError* error = nil;
      id result = [NSJSONSerialization JSONObjectWithData:data 
                                                  options:kNilOptions error:&amp;error];
      if (error != nil) return nil;
      return result;
  }
  @end
  
  @implementation ViewController
  @synthesize name;
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
  
  }
  
  -(void)setDataToJson{
  
      NSDictionary *infomation = [NSDictionary dictionaryWithContentsOfJSONString:@"Test.json"];
      name.text = [infomation objectForKey:@"AnimalName"];//does not pass data
  }
  </code></pre>