DefaultJsonSerializer.cs 522 B

1234567891011121314151617181920212223
  1. using Newtonsoft.Json;
  2. namespace Jwt
  3. {
  4. /// <summary>
  5. /// <see cref="IJsonSerializer"/> implementation using Json.NET.
  6. /// </summary>
  7. public class DefaultJsonSerializer : IJsonSerializer
  8. {
  9. /// <inheritdoc />
  10. public string Serialize(object value)
  11. {
  12. return JsonConvert.SerializeObject(value);
  13. }
  14. /// <inheritdoc />
  15. public T Deserialize<T>(string value)
  16. {
  17. return JsonConvert.DeserializeObject<T>(value);
  18. }
  19. }
  20. }