我正在解码来自 URL 响应的 JSON(解码器)字符串,如下所示,并在解码过程中得到以下错误消息:
错误:
typeMismatch(Swift.String, Swift.DecodingError.Context(codingPath: [_JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "tags", intValue: nil), _JSONKey(stringValue: "Index 0") , intValue: 0)], debugDescription: "预期解码字符串,但找到了一个数字。",underlyingError: nil))
结构:
struct Wordpress: Codable {
let id: Int?
let date: String?
let date_gmt: String?
let guid: GUID?
let modified: String?
let modified_gmt: String?
let slug: String?
let status: String?
let type: String?
let link: String?
let title: Title?
let content: Content?
let excerpt: Excerpt?
let author: Int?
let featured_media: Int?
let comment_status: String?
let ping_status: …Run Code Online (Sandbox Code Playgroud)