Post

Replies

Boosts

Views

Activity

Reply to Coding Error
This is the error... API status: 200 valueNotFound(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "ctatt", intValue: nil), CodingKeys(stringValue: "eta", intValue: nil), _JSONKey(stringValue: "Index 1", intValue: 1), CodingKeys(stringValue: "lat", intValue: nil)], debugDescription: "Expected String value but found null instead.", underlyingError: nil))
Aug ’20
Reply to Coding Error
This is the struct... struct Blueline: Decodable {     let ctatt: Ctatt? } struct Ctatt: Decodable {     let tmst: String?     let errCD: String?     let errNum: String?     let eta: [eta?]     enum CodingKeys: String, CodingKey {         case tmst         case errCD = "errCd"         case errNum         case eta     }     init(from decoder: Decoder) throws {         let container = try decoder.container(keyedBy: CodingKeys.self)            self.tmst = try container.decode(String.self, forKey: .tmst)         self.errCD = try container.decode(String.self, forKey: .errCD)         self.errNum = try container.decodeIfPresent(String.self, forKey: .errNum)         self.eta = try container.decode(Array.self, forKey: .eta)     } } struct eta: Decodable {     let staNm: String?     let stpDe: String?     let rn: String?     let rt: String?     let destSt: String?     let destNm: String?     let prdt: String?     let arrT: String?     let lat: String?     let lon: String?     enum CodingKeys: String, CodingKey {         case staNm         case stpDe         case rn         case rt         case destSt         case destNm         case prdt         case arrT         case lat         case lon     }          init(from decoder: Decoder) throws {         let container = try decoder.container(keyedBy: CodingKeys.self)         self.staNm = try container.decode(String.self, forKey: .staNm)         self.stpDe = try container.decode(String.self, forKey: .stpDe)         self.rn = try container.decode(String.self, forKey: .rn)         self.rt = try container.decode(String.self, forKey: .rt)         self.destSt = try container.decode(String.self, forKey: .destSt)         self.destNm = try container.decode(String.self, forKey: .destNm)         self.prdt = try container.decode(String.self, forKey: .prdt)         self.arrT = try container.decode(String.self, forKey: .arrT)         self.lat = try container.decode(String.self, forKey: .lat)         self.lon = try container.decode(String.self, forKey: .lon)     } }
Aug ’20