title: How to change an NSData to an NSDictionary or JSON
body: <p>I have a swift app that calls api and recieves back a JSON. </p>
  
  <pre><code>    self.get(url).responseJSON { (response) -&gt; Void in
          self.notify(FetchCompletion, response: response.response, result: response.result)
          print("response: ")
          print(response.response)
          print("data: ")
          let dataExample = response.data
          print(dataExample)
          let dictionary:NSDictionary? = NSKeyedUnarchiver.unarchiveObjectWithData(dataExample!)! as? NSDictionary
      }
  </code></pre>
  
  <p>And it prints out:</p>
  
  <pre><code>...
  data: 
  Optional(&lt;7b227374 61747573 223a2234 3034222c 22657272 6f72223a 224e6f74 20466f75 6e64227d&gt;)
  fatal error: unexpectedly found nil while unwrapping an Optional value
  </code></pre>
  
  <p>I want to just print out the data is some readable form by converting to a dictionary. </p>
  
  <p><strong>EDIT 1</strong></p>
  
  <p>My get() function is defined as such:</p>
  
  <pre><code>func get(path: String) -&gt; Request {
  
      return self.get(path, data: NSDictionary())
  }
  </code></pre>
  
  <p><strong>EDIT 2</strong></p>
  
  <p>I am using </p>
  
  <pre><code>import UIKit
  import Alamofire
  import SwiftyJSON
  </code></pre>
  
  <p><strong>EDIT 3</strong></p>
  
  <p>I attempted to follow the example here:<a href="https://stackoverflow.com/questions/31805045/how-to-parse-json-in-swift-using-nsurlsession">How to parse JSON in Swift using NSURLSession</a></p>
  
  <p>But get the error "unresolved identifier 'JSONSerialization'"</p>
  
  <p><strong>EDIT 4 / probable answer</strong></p>
  
  <pre><code>var newdata = JSON(data: dataExample!)
  print(newdata)
  </code></pre>
  
  <p>outputted:</p>
  
  <pre><code>{
    "status" : "404",
    "error" : "Not Found"
  }
  </code></pre>
  
  <p>I believe that this is a json and I am properly printing the readable data, so i believe this is the answer. I was led to this by the comment suggesting to use swiftJSON</p>