但找到了一个字符串/数据,json,swift"/>

首页 > 解决方案 > JSON:预计解码字典但找到了一个字符串/数据

问题描述

下面是 json 响应片段:

 "hp": "130",
 "types": [
      "Lightning"
      ],...

这是我的可解码模型片段:

struct Pokemon: Decodable {
    let hp: String?
    let types: [Types]?
}

struct Types: Decodable {
    let types: String
}

这篇文章的标题是我得到的错误。我已经尽我所能,但仍然无法修复错误。非常感谢

标签: jsonswift

解决方案


推荐阅读