-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
| Previous ID | SR-6163 |
| Radar | rdar://problem/38549586 |
| Original Reporter | mikkelam (JIRA User) |
| Type | Bug |
| Status | Resolved |
| Resolution | Done |
Additional Detail from JIRA
| Votes | 23 |
| Component/s | Foundation |
| Labels | Bug, Codable |
| Assignee | @itaiferber |
| Priority | Medium |
md5: 7ea104c1b9f4df36ef6d428fc2c7cfd0
is duplicated by:
- SR-7213 Allow JSONEncoder to Encode Top-Level Fragments
relates to:
- SR-12275 JSONEncoder on Linux can't encode number JSON fragments
Issue 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.