title: Xcode : Alamofire get String response
body: <p>I am new in IOS development and currently learning networking with Alamofire</p>
  
  <p>i am trying to make a login ...
  whenever the credentials are correct the .php file returns a <code>json</code> and i am able to get that json from <code>Alamofire</code> through the following code:</p>
  
  <pre><code>    Alamofire.request(loginUrl, method: .post, parameters: parameters).responseJSON { (response:DataResponse&lt;Any&gt;) in
          print("String:\(response.result.value)")
          switch(response.result) {
          case .success(_):
              if let data = response.result.value{
                  print(self.loginUrl)
                  print(data)
              }
  
          case .failure(_):
  
              print(self.loginUrl)
              print("failed")
              print("Error message:\(response.result.error)")
              break
  
          }
      }
  </code></pre>
  
  <p>now...when ever the credentials are wrong, the .php does't give the json..instead it return a string ..for example "wrong_password" or "userLocked" etc etc...
  how can i get the String response through Alamofire?</p>