struct Prices: Codable {
let prices: [[Double]]
}
But you can customize it as you wish, if we had more context we could help farther. For example in the list we know that there will always be two elements one represents high price and the other low price then we can do
struct Price {
let high: Double
let low: Double
init(list: [Double] {
self.high = list[0]
self.low = list[1]
}
}
struct Prices: Codable {
let prices: [Price]
enum CodingKeys: String, CodingKey {
case prices
}
init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.prices = try container.decode([[Double]].self, forKey: .prices).map(Price.init)
}
… todo ecode if you really want to conform to Codable. But just parsing can be just Decodable
}