Decoding a JSON without keys in Swift 4

If the structure stays the same, you can use this Decodable approach. First create a decodable Model like this: struct MyModel: Decodable { let firstString: String let stringArray: [String] init(from decoder: Decoder) throws { var container = try decoder.unkeyedContainer() firstString = try container.decode(String.self) stringArray = try container.decode([String].self) } } Or if you really want to … Read more

tech