PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, December 4, 2022

[FIXED] How does swift JSONEncoder() encode swift NSDate/ Data types?

 December 04, 2022     binary, jsonencoder, node.js, swift, websocket     No comments   

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)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing