Ios 使用moya发送一个快速JSON数组

Ios 使用moya发送一个快速JSON数组,ios,swift,swifty-json,moya,Ios,Swift,Swifty Json,Moya,我试图使用moya发送json对象的快速json数组,但它不断产生错误并崩溃 我的任务如下: case let .example(token, json): return .requestParameters(parameters: ["token": token, "choices": json!.array as Any], encoding: JSONEncoding.default) 其中,token只是一个字符串,json是json类型 错误是: ***由于未捕获异常“NSI

我试图使用moya发送json对象的快速json数组,但它不断产生错误并崩溃

我的任务如下:

case let .example(token, json):
    return .requestParameters(parameters: ["token": token, "choices": json!.array as Any], encoding: JSONEncoding.default)
其中,token只是一个字符串,json是json类型

错误是:

***由于未捕获异常“NSInvalidArgumentException”而终止应用程序,原因:“JSON写入中的类型无效(_SwiftValue)”

有什么想法吗?
谢谢

错误是什么?在哪一行?请多给点details@Skywalker在问题中添加了错误。不显示在哪一行上-但当仅使用字符串或数组时,相同的调用有效,但在使用SwiftyJSON对象时无效。
case let .example(token, json):
  var parameters: [String : Any] = [:]
  parameters["token"] = token
  parameters["choices"] = products.map({
      key, value in
      return [ "product_id": key, "qty": value ]
  })
  return .requestParameters(parameters: parameters, encoding: JSONEncoding.prettyPrinted)