[Solved] Store value from JSON to a variable [closed]


Based on this file https://pastebin.com/Z3vJsD77 you posted above.

You can directly access the chargeLimitSOC property from this model like following –

let chargeLimitSOC = chargeState.chargeLimitSOC

Relevant part in your model is here –

open class ChargeState: Codable {
    open var chargeLimitSOC: Int?
    
    enum CodingKeys: String, CodingKey {
        case chargeLimitSOC = "charge_limit_soc"
    }
}

1

solved Store value from JSON to a variable [closed]