One", "description": "This is the first item." }, { "id": 2, "value": "B002", "name": "Item Two", "description": "This is the second item." }, { "id": 3, "value": "C003", "name": "Item Three", "description": "This is the third item." } ] } struct ItemResponse: Codable { let items: [Item] } struct Item: Codable { let id: Int let value: String? let name: String let description: String? } struct Item: Codable { let id: Int let value: String? = "" let name: String let description: String? } 要不要⽤ default value?
One", "description": "This is the first item." }, { "id": 2, "value": "B002", "description": "This is the second item." }, { "id": 3, "value": "C003", "name": "Item Three", "description": "This is the third item." } ] } 沒有 name parse fail 還是 drop item?