Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSwiftCodable custom keysSingle-choice MCQ

What does encoding this value with `JSONEncoder` produce for the key names?

struct User: Codable { let firstName: String let age: Int enum CodingKeys: String, CodingKey { case firstName = "first_name" case age } } let data = try JSONEncoder().encode(User(firstName: "Ada", age: 36)) print(String(data: data, encoding: .utf8)!)