I have an app that get some JSON data from server, that looks like this:
"operationsInfo": {
    "bill": {
        "activeProviders": [
              {
                "max": 50,
                "min": 10,
                "name": "name1"
              },
              {
                "max": 50,
                "min": 10,
                "name": "name2"
              }
         ]
    },
    "pin": {
        "activeProviders": [
              {
                "max": 50,
                "min": 10,
                "name": "name3"
              },
              {
                "max": 50,
                "min": 10,
                "name": name4
              }
        ]
    }
}
how can I use swift decodable protocol to deserialized this JSON data? my custom object looks like this:
struct operationList: Decodable {
    let name: String
    let action: String
    let min, max: Int
}
the action value in operationList object must equal to "bill" or "pin". finally I want to get an array of operationList object type when decoding JSON data, for example:
let operationListArray = [operationList1, operationList2, operationList3, operationList4] operationList1.action = "bill", operationList1.max = 50, operationList1.name = "name1" operationList2.action = "bill", operationList2.max = 50, operationList2.name = "name2" operationList3.action = "pin", operationList3.max = 50, operationList3.name = "name3" operationList4.action = "pin", operationList4.max = 50, operationList4.name = "name4"
I already see other answer like this for example: How to decode a nested JSON struct with Swift Decodable protocol? but my problem is how I can put "bill" or "pin" in action value, and in future it is possible new key value like "transfer"(like "pin" or "bill") added to JSON data.
 
    