Details
-
Type:
Bug
-
Status: Resolved
-
Priority:
Medium
-
Resolution: Done
-
Component/s: Foundation
-
Labels:
-
Radar URL:
Description
For example
22
Is valid RFC 7159 JSON. This can be parsed using the JSONSerializer like so
let json = "22".data(using: .utf8)! if let value = (try? JSONSerialization.jsonObject(with: json, options: .allowFragments)) as? Int { print(value) // 22 }
But there is no way to use the allowFragments option for JSONDecoder.