Swift3 如何使用Alamofire从JSON获取数据?

Swift3 如何使用Alamofire从JSON获取数据?,swift3,Swift3,我试图通过Alamofire从JSON获取数据,但数据来自[“Chris Martin”],而不是Chris Martin。检查此图像 这是我的密码 @IBAction func botaoSalvar(_ sender: Any) { let nomeUsuario = self.campoUsuario.text; let cpf = self.campoCPF.text; let senha = self.campoSenha.text; let pa

我试图通过
Alamofire
JSON
获取数据,但数据来自[“Chris Martin”],而不是Chris Martin。检查此图像

这是我的密码

@IBAction func botaoSalvar(_ sender: Any) {

    let nomeUsuario = self.campoUsuario.text;
    let cpf = self.campoCPF.text;
    let senha = self.campoSenha.text;

    let param = ["nome": nomeUsuario, "cpf": cpf, "senha": senha, "method": "app-set-usuario"]
    var _: HTTPHeaders = ["Content-Type": "application/json"]
    let url = "http://easypasse.com.br/gestao/wsCadastrar.php"

    Alamofire.request(url, method:.post, parameters:param,encoding: JSONEncoding.default).responseJSON { response in
        switch response.result {
        case .success:
            //print(response)
            let json = JSON(response.result.value as Any)
            let idusuario =  json["usuario"].arrayValue.map({$0["idUsuario"].stringValue})
            let nome =  json["usuario"].arrayValue.map({$0["nome"].stringValue})
            let cpf =  json["usuario"].arrayValue.map({$0["cpf"].stringValue})

            print(idusuario)
            print(nome)
            print(cpf)

        case .failure(let error):
            print(0,"Error")
        }
    }
我该怎么修?
谢谢。

我不明白你的意思。我知道英语不是你的第一语言,但你有没有机会把你的问题重新表述一下?对不起,我把“和”改为“e”。。。也许这就是你不理解的原因,它看起来不像是一个Swift特定的问题,但不管Alamofire解析JSON做什么。看起来您是在
usuario
中直接请求一个映射的值数组,因此Alamofire中的JSON解析就是为了实现这一点。