'Create common codable for slightly different json responses - Swift
How to create a common codable struct in swift for slightly different json responses.For example response A and B has almost same attributes and B has some extra attribute called Designation.Is it possible to create common codable struct for this scenario?
//Response A
{
"name" : "Jhon",
"age" : 23,
"mobile" : "+11012341234",
.
.
.
}
//Response B
{
"name" : "Jhon",
"age" : 23,
"mobile" : "+11012341234",
.
.
.
"designation": "Manager"
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
