Open leonidas-o opened 7 years ago
Using: Vapor 2.3.0 (JSON 2.2.1)
struct JSONStruct: Codable { var is_disabled: Bool } let jsonStruct = JSONStruct(is_disabled: false) let jsonData = try Foundation.JSONEncoder().encode(jsonStruct) let json = try JSON(bytes: jsonData) print(json)
When looking at the json variable and the print out, is_disabled has been converted to a double of 0.0 although it should stay false.
json
is_disabled
0.0
false
Unfortunately Swift's Foundation JSON (before 4.0) forces us to have fuzzy bool/double/int support. If you are using Swift 4, you can opt for Codable instead. We will support that natively in Vapor 3.
Using: Vapor 2.3.0 (JSON 2.2.1)
When looking at the
json
variable and the print out,is_disabled
has been converted to a double of0.0
although it should stayfalse
.