title: How to send parameters as string in alamofire
body: <p>I must receive JSON data specifying a payload that I need to pass to a url. It will look like this:</p>
  
  <pre><code>{
    "token": "string",
    "body": {
      "token": "another string",
      "intValue": 1,
      "somethingElse": "another string"
    }
  }
  </code></pre>
  
  <p>I know that <em>body</em> will have properties that are always, either a string or a number. But I don't know what the key will be that pairs with a valie of string or int.</p>
  
  <p>I need to then send that body with Alamofire, which I was doing like this:</p>
  
  <pre><code>// parsing the data received with the Codable:
  struct NotificationDetails: Codable {
      let token: String
      let body: [String:String]?
      let
  
      init (token: String) {
          self.token = token
          self.body = nil
      }
  
      init (token: String, body: [String:String]) {
          self.token = token
          self.body = body
      }
  
  }
  </code></pre>
  
  <p>Note that I can't just use Alamofire's handy Parameters type like:</p>
  
  <pre><code>struct NotificationDetails: Codable {
      let token: String
      let body: Parameters?
  
      init (token: String) {
          self.token = token
          self.body = nil
      }
  
      init (token: String, body: Parameters) {
          self.token = token
          self.body = body
      }
  }
  </code></pre>
  
  <p>because that is not codable, just like AnyObject.</p>
  
  <pre><code>// then elsewhere, using that data
  guard let bodyJSON = localNotificationDetails.body else {
     callback()
     return
  }
  AF.request(url, method:method, parameters: bodyJSON).responseJSON(queue: queue) { response in
  </code></pre>
  
  <p>but now that I see that some of my data is going to be numeric instead of string, I'm wondering how I can do this now?</p>