title: iOS5/xCode Setting up an array with a json file for use later on
body: <p>I have the following code that I run at viewDidLoad:</p>
  
  <pre><code>  NSString *json_list = [[NSBundle mainBundle] pathForResource:@"mylist" ofType:@"json"];
  NSData *theList   =   [NSData dataWithContentsOfFile: json_list];
  NSInputStream *listStream = [[NSInputStream alloc] initWithData:theList];
  [listStream open];
  
  if (showStream) {
      NSError *parseError = nil;
      id jsonObject = [NSJSONSerialization JSONObjectWithStream:listStream options:NSJSONReadingAllowFragments error:&amp;parseError];        
      if ([jsonObject respondsToSelector:@selector(objectForKey:)]) {
          for (NSDictionary *firstItem in [jsonObject objectForKey:@"list"]) {
              NSLog(@"Title: %@", [firstItem objectForKey:@"title"]);
          }
      }
  } else {
      NSLog(@"Failed to open stream.");
  }
  </code></pre>
  
  <p>All is OK but I would like to store this information into say an array so that I can use later within this view, but I have had a go at soem various array methods mutable etc but seem to have got stuck at this part of it:</p>
  
  <p>Ideally instead of the NSLog bit:</p>
  
  <pre><code>   NSLog(@"Title: %@", [firstItem objectForKey:@"title"]);
  </code></pre>
  
  <p>this is where I would probably add it to an array, but how can I do this to use later on?</p>
  
  <p>Thanks</p>