Closed
Description
Previous ID | SR-2694 |
Radar | None |
Original Reporter | saiHema (JIRA User) |
Type | Bug |
Status | Resolved |
Resolution | Done |
Additional Detail from JIRA
Votes | 0 |
Component/s | Foundation |
Labels | Bug |
Assignee | saiHema (JIRA) |
Priority | Medium |
md5: 216c7a16ed8c93d5468c3eabaaca7d5c
relates to:
- SR-3013 JSONSerialization coerces booleans to numbers on Linux
Issue Description:
import Foundation
JSONSerialization.data(withJSONObject: [true])
on macOS (0829) and Ubuntu 15.10 (0905) REPLs. This code runs on macOS but errors in Ubuntu with this message:
$E0: Error = {
instance_type = {
Foundation.NSObject = {}
_domain = "NSCocoaErrorDomain"
_code = 3840
_userInfo = 1 key/value pair {
[0] = {
key = "NSDebugDescription"
value = "Invalid object cannot be serialized"
}
}
}
}
Also
import Foundation
JSONSerialization.isValidJSONObject([1]) returns true on macOS and false on linux