Issue
In swift how does the JSOnEncoder() encode Data data types?
Here is my struct that i am encoding
struct VoiceQueryRequest: Codable {
var type:String = "voiceQuery"
var audioOutput:Data = Data()
}
Im using websockets to send the encoded json object to a node server. Im using URLSessionWebSocketTask.Message.data to create the websockets message.
I need to understand how the audioOutput: Data propertie is encoded so that i can decode the object on the server.
Solution
JSONEncoder
has a dataEncodingStrategy
property that determines how Data
properties are encoded. The default is to encode it as a base 64 string.
Answered By - dan Answer Checked By - Robin (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.