title: JSON parse error: The data couldn’t be read because it isn’t in the correct format
body: <p>I am new to Xcode and Swift and have the below code that shows error on <code>print(parseJSON)</code>.</p>
  
  <blockquote>
    <p>Error: The data couldn’t be read because it isn’t in the correct
    format.</p>
  </blockquote>
  
  <p>The code is posting data correctly to the server, but the response cannot be parsed.</p>
  
  <p>JSON response from my ASMX page:</p>
  
  <pre><code>{"status":"Success","message":"User is registered"}
  </code></pre>
  
  <p>Any help will be appreciated.</p>
  
  <pre><code>// Send data to server side
  
  let myURL = NSURL(string: "http://www.examle.com/Info.asmx/Testing")
  let request = NSMutableURLRequest(URL: myURL!)
  request.HTTPMethod = "POST"
  
  let postString = "Email=\(userEmail!)&amp;Password=\(userPassword!)"
  print(postString)
  
  request.HTTPBody = postString.dataUsingEncoding(NSUTF8StringEncoding)
  
  let task = NSURLSession.sharedSession().dataTaskWithRequest(request){
      data, response, error in
  
      if error != nil {
          print("error=\(error)")
          return
      }
  
      //var err: NSError?
      do{
          if let parseJSON = try NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions.MutableContainers) as? NSDictionary{
              print(parseJSON) // ERROR HERE
  
              let resultValue = parseJSON["status"] as? String
              print("result: \(resultValue)")
  
              var isUserRegistered:Bool = false
              if (resultValue == "Success") {
                  isUserRegistered = true
              }
  
              var messageToDisplay:String = parseJSON["message"] as! String!
  
              if (!isUserRegistered){
                  messageToDisplay = parseJSON["message"] as! String!
              }
  
              dispatch_async(dispatch_get_main_queue(), {
                  let myAlert = UIAlertController(title: "Alert", message: messageToDisplay, preferredStyle: UIAlertControllerStyle.Alert)
  
                  let okAction = UIAlertAction(title: "OK", style: UIAlertActionStyle.Default){ action in
                      self.dismissViewControllerAnimated(true, completion: nil)
                  }
  
                  myAlert.addAction(okAction)
                  self.presentViewController(myAlert, animated: true, completion: nil)
              })
          }
      } catch let error as NSError {
           print(error.localizedDescription)
      }
  
  }
  
  task.resume()
  </code></pre>