-
Notifications
You must be signed in to change notification settings - Fork 63
Open
Description
Hi,
I have troubles with parsing simple values, like Float,
i wrote simple test:
{
"floatArray": [9.123, 0.000001, 0.1, -2]
}func testParseFloatArray() {
guard let path = Bundle(for: type(of: self)).path(forResource: "FloatArray", ofType: "json"),
let data = try? Data(contentsOf: URL(fileURLWithPath: path)),
let json = try? JSONParser.JSONObjectWithData(data) else {
XCTFail("Error parsing FloatArray.json")
return
}
do {
let array: [Float] = try json.value(for: "floatArray")
XCTAssert(array.count == 5)
XCTAssert(array[0] == 9.123)
} catch {
XCTFail(String(describing: error))
}
}
and it fails with:
▿ Type mismatch. Expected type Float for key: floatArray. Got '__NSCFNumber'
▿ typeMismatchWithKey : 3 elements
- key : "floatArray"
- expected : Swift.Float
- actual : __NSCFNumber
Should i try to make pull request with fix for this?
Metadata
Metadata
Assignees
Labels
No labels