I'm consuming an API that looks like very similar to this:
{
"email": "[email protected]",
"settings": [
{
"setting_A": {
"value": -65,
}
},
{
"setting_B": {
"value": {
"b1": {
"val": 12,
"unit": "kg"
},
"b2": {
"val": 10,
"unit": "g"
}
}
}
}
]
}
I'm stuck on decoding this JSON result esp. settings. Can someone help me how to?
This is what I have so far:
struct User: Decodable {
let email: String
let settings: [Setting] // not sure how to do this :(
}