title: How to get readable JSON after NSJSONSerialization.dataWithJSONObject in Swift
body: <p>I have some code similar to this (I've simplified it here):</p>
  
  <pre><code>let text = "abc" let iosVersion = UIDevice.currentDevice().systemVersion
  
  let message = ["Text" : text, "IosVersion" : iosVersion]
  
  if NSJSONSerialization.isValidJSONObject(message){
  
      let url = NSURL(string: "http://localhost:3000/api/someapi")
  
      var request = NSMutableURLRequest(URL: url!)
      var data = NSJSONSerialization.dataWithJSONObject(message, options: nil, error: nil)
  
  
      print(data)
  
      request.addValue("application/json", forHTTPHeaderField: "Content-Type")
      request.HTTPMethod = "POST"
      request.HTTPBody = data
  
      let task = session.dataTaskWithRequest(request, completionHandler: nil)
  
      task.resume()
  }
  </code></pre>
  
  <p>This works fine, but I'd like to see the JSON in a readable format so that I can copy/paste it into fiddler/curl to help diagnose my API at the server end. The <code>println(data)</code> line above gives me hexadecimal data. Any ideas?</p>