DefaultJsonEncoder.cs 575 B

123456789101112131415161718192021222324
  1. #if !BESTHTTP_DISABLE_SIGNALR
  2. using BestHTTP.JSON;
  3. using System.Collections.Generic;
  4. namespace BestHTTP.SignalR.JsonEncoders
  5. {
  6. public sealed class DefaultJsonEncoder : IJsonEncoder
  7. {
  8. public string Encode(object obj)
  9. {
  10. return Json.Encode(obj);
  11. }
  12. public IDictionary<string, object> DecodeMessage(string json)
  13. {
  14. bool ok = false;
  15. IDictionary<string, object> result = Json.Decode(json, ref ok) as IDictionary<string, object>;
  16. return ok ? result : null;
  17. }
  18. }
  19. }
  20. #endif