using System;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Jellyfin.Extensions.Json.Converters
{
///
/// Converts an object to a lowercase string.
///
/// The object type.
public class JsonLowerCaseConverter : JsonConverter
{
///
public override T? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
return JsonSerializer.Deserialize(ref reader, options);
}
///
public override void Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options)
{
writer.WriteStringValue(value?.ToString()?.ToLowerInvariant());
}
}
}