DefaultJSonEncoder.cs 606 B

12345678910111213141516171819202122232425
  1. #if !BESTHTTP_DISABLE_SOCKETIO
  2. using System.Collections.Generic;
  3. using BestHTTP.JSON;
  4. namespace BestHTTP.SocketIO.JsonEncoders
  5. {
  6. /// <summary>
  7. /// The default IJsonEncoder implementation. It's uses the Json class from the BestHTTP.JSON namespace to encode and decode.
  8. /// </summary>
  9. public sealed class DefaultJSonEncoder : IJsonEncoder
  10. {
  11. public List<object> Decode(string json)
  12. {
  13. return Json.Decode(json) as List<object>;
  14. }
  15. public string Encode(List<object> obj)
  16. {
  17. return Json.Encode(obj);
  18. }
  19. }
  20. }
  21. #endif