I'm using Alamofire to decode objects, and my JSON looks like this
{
"wallet": {
"public_key": "ADDRESS",
"name": "My test wallet",
"id": "-MQ9NdAyMaK3WQfSOYZW",
"owner": "Kca8BNHy8FemIxPO7FWBSLE8XKN2",
"currency": "ME",
"metadata": {
"legacy_address": "WHAT",
"x_pub_address": "SOMETHING COOL"
}
},
"secrets": {
"wif": "SOMETHING",
"private_key": "SOMETHING ELSE",
"mnemonic": "YOU WISH"
}
}
My Swift looks like this:
class Response: Codable {
var wallet: Wallet
var secrets: [String: String]
}
class Wallet: Codable {
var publicKey: String
var name: String
var id: String
var owner: String
var currency: String
var metadata: [String: String]
enum WalletKeys: String, CodingKey{
case publicKey = "public_key",
case name,
case id
case owner,
case currency,
case metadata
}
}
I'm getting a keyNotFound(CodingKeys(stringValue: "publicKey"))
error, and I dont know why. Can someone help me figure this out?