You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
630 B
28 lines
630 B
#if !BESTHTTP_DISABLE_SIGNALR |
|
|
|
using System.Collections.Generic; |
|
|
|
using BestHTTP.JSON.LitJson; |
|
|
|
namespace BestHTTP.SignalR.JsonEncoders |
|
{ |
|
public sealed class LitJsonEncoder : IJsonEncoder |
|
{ |
|
public string Encode(object obj) |
|
{ |
|
JsonWriter writer = new JsonWriter(); |
|
JsonMapper.ToJson(obj, writer); |
|
|
|
return writer.ToString(); |
|
} |
|
|
|
public IDictionary<string, object> DecodeMessage(string json) |
|
{ |
|
JsonReader reader = new JsonReader(json); |
|
|
|
return JsonMapper.ToObject<Dictionary<string, object>>(reader); |
|
} |
|
} |
|
} |
|
|
|
#endif
|
|
|