struct DTO: Decodable {
let amount: Decimal
}
let backendResponse = """
{"amount": 90.21}
""".data(using: .utf8)!
let decoded: DTO = try! JSONDecoder().decode(DTO.self, from: backendResponse)
debugPrint(decoded.amount)
this results in "90.20999999999999" using the playground
Topic:
Programming Languages
SubTopic:
Swift
Tags: