Dare anyone try the following code in any Playground:
// Define a model that conforms to Codable struct User: Codable { var name: String var age: Int var email: String? } // JSON data (as a string for demonstration) let jsonString = """ { "name": "John Doe", "age": 30, "email": "john@example.com" } """ // Convert the JSON string to Data if let jsonData = jsonString.data(using: .utf8) { do { // Parse the JSON data into the User model let user = try JSONDecoder().decode(User.self, from: jsonData) print("Name: \(user.name), Age: \(user.age), Email: \(user.email ?? "N/A")") } catch { print("Error decoding JSON: \(error)") } }
I tested with Xcode 16.2 and latest 16.3, it reliably crashes the lldb server!