Due to the current awful state of the doc, I cannot figure out why the doc implies you could encode Data into JSON, but you cannot.
1) JSONEncoder/JSONDecoder requires Codable protocol adopting objects.
2) Codable is just Encodable & Decodable
3) The Data class conforms to Encodable & Decodable
4) The JSONEncoder & JSONDecoder classes have a property (dataEncodingStrategy,dataDecodingStrategy) to determine how to deal with raw data (default if base64)
BUT Data does not adopt the Codable protocol (only Encodable & Decodable) so JSONEncoder fails if you try to include Data.
Why? What are those properties for on JSONEncoder/JSONDecoder if not related to Data? Why not take the extra step and declare Data Codable as it already conforms to it's components?