title: Parse JSON in SWIFT
body: <p>Hi i try to find a way to parse JSON in SWIFT, this works great for me but i run into a problem.</p>
  
  <p>I let the user enter a username that is used for the JSON URL -> if the user type in a valid username all works fine.</p>
  
  <p>But if he enter a wrong username my parsing fails, this is correct too, but for now my app only crashes and i looking for a way to make a work around.</p>
  
  <p>This is my Code where it crashes,</p>
  
  <pre><code> let url0 = NSURL(string: newUrlPath!)
          let session0 = NSURLSession.sharedSession()
          let task0 = session0.dataTaskWithURL(url0!, completionHandler: {data, response, error -&gt; Void in
              if (error != nil) {
                  println(error)
              } else {
                  let summonorID_JSON = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: nil) as NSDictionary
  </code></pre>
  
  <p>The Xcode Error</p>
  
  <blockquote>
    <p>Error Domain=NSURLErrorDomain Code=-1002 "The operation couldn’t be
    completed. (NSURLErrorDomain error -1002.)" UserInfo=0x7c12d610
    {NSErrorFailingURLKey=XX, NSErrorFailingURLStringKey=XX,
    NSUnderlyingError=0x7c12c8d0 "The operation couldn’t be completed.
    (kCFErrorDomainCFNetwork error -1002.)"} fatal error: unexpectedly
    found nil while unwrapping an Optional value</p>
  </blockquote>
  
  <p>All is fine cause this is the return page i get from my Request </p>
  
  <p><a href="https://br.api.pvp.net/api/lol/br/v1.4/summoner/by-name/smirknaitiax?api_key=5c7d4d4f-f320-43d5-8647-643c9f6ee5de" rel="nofollow">https://br.api.pvp.net/api/lol/br/v1.4/summoner/by-name/smirknaitiax?api_key=5c7d4d4f-f320-43d5-8647-643c9f6ee5de</a></p>
  
  <p>And yes he can't parse this into a NSDirectory as its no JSON that returns (as its normally is) is there a way to take care that if this page comes up (so the user entered a wrong username) that i can exit my loop/take a other way ;)?</p>