Open
Description
If you run the following code on macOS, the output will be 68.31999999999999
:
let jsonString = """
{
"amount": 68.32
}
let json = jsonString.data(using: .utf8)!
let serialized = try JSONSerialization.jsonObject(with: json) as! [String: Any]
let amount = serialized["amount"]
print(amount)
However, if you run the same code on SwiftFiddle (using the x86_64-unknown-linux-gnu
platform), the output will be 68.32
.
Metadata
Metadata
Assignees
Labels
No labels