title: JSON Serialize Emoji
body: <p>I need to send a message to the server which contains emojis. I read the data from CoreData, store it in dictionary and then convert it into json format.</p>
  
  <p>My initial dictionary has following content</p>
  
  <pre><code>["0": ["chat_token": "8g9nu0Z.a3", "message": "", "user_id": "1242", "created": "2017-12-29 17:13:16"]]
  </code></pre>
  
  <p>I then convert it into JSON using following code</p>
  
  <pre><code>do {
      let jsonData = try JSONSerialization.data(withJSONObject: resultDict, options: [])
      if let jsonText = NSString(data: jsonData, encoding: String.Encoding.ascii.rawValue) {
          return jsonText as String
      }
  } catch let error {
      print(error)
  }
  </code></pre>
  
  <p>This returns me following json string</p>
  
  <pre><code>{"0":{"chat_token":"8g9nu0Z.a3","message":"ð¤ð","user_id":"34","created":"2017-12-29 17:13:16"}}
  </code></pre>
  
  <p>The problem is emojis are not correctly formatted. In JSON it gets converted to <code>ð¤ð</code> </p>
  
  <p>The reason I need it is to send it to the server to store the message. How do I convert emoji to json string format.</p>