如您所说,您的json数组是多类型的,但您尝试将所有内容解码为
String。默认的一致性
String,以
Decodable不允许。我想到的唯一解决方案是引入新类型。
struct IntegerOrString: Decodable { var value: Any init(from deprer: Deprer) throws { if let int = try? Int(from: deprer) { value = int return } value = try String(from: deprer) }}struct ChildrenTable: Decodable { var values: [[IntegerOrString]]?}在线运行



