title: Objective C to Swift JSON Parsing
body: <p>how can i convert this code into Swift?</p>
  
  <pre><code>- (void)fetchFeed
  {
      NSString *requestString = @"https://bookapi.bignerdranch.com/private/courses.json";
      NSURL *url = [NSURL URLWithString:requestString];
      NSURLRequest *req = [NSURLRequest requestWithURL:url];
  
      NSURLSessionDataTask *dataTask =
          [self.session dataTaskWithRequest:req
                          completionHandler:
           ^(NSData *data, NSURLResponse *response, NSError *error) {
  
               NSDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData:data
                                                                          options:0
                                                                            error:nil];
               self.courses = jsonObject[@"courses"];
  
               NSLog(@"%@", self.courses);
  
               dispatch_async(dispatch_get_main_queue(), ^{
                   [self.tableView reloadData];
               });
           }];
      [dataTask resume];
  }
  </code></pre>
  
  <p>i try to convert it in this, but xcode crashes</p>
  
  <pre><code> func fetchFeed(){
  
          var requestString = "http://bookapi.bignerdranch.com/courses.json"
          var url = NSURL(string: requestString)
          var req = NSURLRequest(URL: url!)
  
          var dataTask:NSURLSessionDataTask = self._session.dataTaskWithRequest(req, completionHandler: { (data : NSData!, response : NSURLResponse!, error : NSError!) -&gt; Void in
  
             //var json:NSDictionary = NSJSONSerialization.JSONObjectWithData(data: NSData!, options: NSJSONReadingOptions.allZeros, error: NSError!)
  
              var json: NSDictionary = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.allZeros, error: NSErrorPointer.null()) as NSDictionary
  
              self._courses = json["courses"]![0] as NSArray
  
              println("\(json)")
          })
  
          dataTask.resume()
      }
  </code></pre>
  
  <p>the problem should be this line  <code>self._courses = json["courses"]![0] as NSArray</code>
  i guess it has to be some sort of errors with optionals. dunno what exactely</p>
  
  <p>How can i solved it? please help me </p>