How do I use JSON arrays with Alamofire parameters?

前端 未结 8 1995
借酒劲吻你
借酒劲吻你 2021-01-05 01:03

I\'m having a bit of trouble structuring my parameters so that our server API would be able to read it as valid JSON.

Alamofire uses parameters like this in swift la

8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-05 01:27

    Using Swift 5 You can use like this.

      var authParams:[String:Any] = [:]
    
      var authParamsObject:[String:Any] = [:]
    
    
        authParamsObject["is_urgent"] = data_any
        authParamsObject["body"] = data_any
    
      authParams = ["note_set" : authParamsObject]
    

    Json Result :

    {
      "note_set":
        {
          "is_urgent": true,
          "body": "string"
        }
    }
    

提交回复
热议问题