title: Pass array of string in parameter request - swift 5
body: <p>Pass array of string in parameter request - swift 5. I want to send an array in a parameter from an alamofire request.</p>
  
  <p>This is the request on Postman:</p>
  
  <p><img src="https://i.stack.imgur.com/pwXwF.png" alt=""></p>
  
  <p><img src="https://i.stack.imgur.com/mKL1a.png" alt="">
  This is my solution:</p>
  
  <pre><code>var Token : String?
         var  tasksMO = [NSManagedObject]()
         let request = NSFetchRequest&lt;NSFetchRequestResult&gt;(entityName: "ConfirmActivationEntity")
         do {
             let results = try pe.context.fetch(request)
             tasksMO = results as! [NSManagedObject]
             for taskmo in tasksMO {
                 Token = (taskmo.value(forKey: "access_token")  as! String )
             }
             print("assbil")
         } catch {
             print("fild")
         }
   print(" Token :\(Token!)")
  let levels  : [String]  = ["+972569431827","+972598110437","+972592923343","3555656","00970567163651","258258"]
  
  let paramsJSON = JSON(levels)
  debugPrint(paramsJSON)
  let parameters : [String : Any] = ["contacts":paramsJSON,"platform":2]
  
  
   let headers : HTTPHeaders = ["Authorization":"Bearer \(Token!)","Accept-Language" : Locale.current.languageCode ?? "ar", "Content-Type" : "application/x-www-form-urlencoded","Accept" : "application/json"]
  
  guard let url = URL(string: "\(UrlApi.url)\(UrlApi.contactsPost)") else { return }
  
     sdLoader.startAnimating(atView: self.view)
     Alamofire.request(url, method: .post, parameters: parameters, headers: headers).responseJSON { response in
       if let error = response.error {
             print(error)
             return
         }
  
         if let status = response.response?.statusCode {
          print(status)
          print(response.result.value!)
           switch(status){
             case 200:
  
          self.sdLoader.stopAnimation()
           do{
                let decoder = JSONDecoder()
                let userResultDec = try decoder.decode(ContactsJSON.self, from: response.data!)
                decoder.keyDecodingStrategy = .convertFromSnakeCase
                 if userResultDec.status == true {
  
                  print(userResultDec.items)
  
                 } else if userResultDec.status == false {
                     self.showAlert(title: "رسالة", message: "هناك خطا بالمعلومات المدخلة", style: .alert)
             }
  
  
            }  catch let parsingError {
                 print("Error", parsingError)
                 MessageBox.Show(Message: " \(parsingError) , خطأ في السيرفير ", MyVC: self)
            }
             case 401 :
              self.sdLoader.stopAnimation()
                print("error with response status: \(status)")
                print("خطأ في السيرفير")
                MessageBox.Show(Message: "error with response status: \(status) , خطأ في السيرفير ", MyVC: self)
             case 404 :
              self.sdLoader.stopAnimation()
                print("error with response status: \(status)")
                print("خطأ في السيرفير")
                MessageBox.Show(Message: "error with response status: \(status) , خطأ في السيرفير ", MyVC: self)
  
           case 500:
                MessageBox.Show(Message: "error with response status: \(status) , خطأ في السيرفير ", MyVC: self)
              default:
               print("Error")
  
             }
         }
      }
  </code></pre>
  
  <p>The problem is:
  The items in the array do not appear in the reference response from the server</p>
  
  <p>I am using the Alamofire pod and the SwiftyJson pod with iOS 13, Swift 5, and Xcode 11.</p>