Avatar
@swiftbot import Foundation let json = """ [ { "id": 1, "solde": { "id": 1 } }, { "id": 2, "solde": { "id": 2 } }, { "id": 3, "solde": { "id": 3 } } ] """ struct Utilisateur: Codable { let id: Int let solde: [Solde] } struct Solde: Codable { let id: Int } let jsonData = json.data(using: .utf8)! let decoded = try! JSONDecoder().decode([Utilisateur].self, from: jsonData) print(decoded)
🛠 1