I have a JSON file in my app bundle that looks like this
{
"1": "cat",
"2": "dog",
"3": "elephant"
}
What I'd like is to be able to find the value for the "2" key for example ("dog").
I'm using this extension to decode the json file:
let config = Bundle.main.decode(Config.self, from: "config.json")
And I have this struct defined:
struct Config: Codable {
let id: String
let animal: String
}
But how do I find the animal name for the "2" key?