I though I had this concept nailed!
I am sending a JSON which contains a double.
{\"elementName\":\"Security:Driver\",\"element_Cost\":\"650\"}
"650" is a string, not a number.
"650"
You can parse it like this
let elementCostString = try values.decode(String.self, forKey: .elementCost) elementConst = Double(elementCostString) ?? 0
Or change it to be a String on your model, whichever works better for you.