mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 19:37:55 +02:00
add camelCase formatter
This commit is contained in:
parent
16401ec7ae
commit
ad67081840
1 changed files with 21 additions and 0 deletions
21
Jellyfin.Server/Formatters/CamelCaseJsonProfileFormatter.cs
Normal file
21
Jellyfin.Server/Formatters/CamelCaseJsonProfileFormatter.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using System.Text.Json;
|
||||
using Microsoft.AspNetCore.Mvc.Formatters;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
|
||||
namespace Jellyfin.Server.Formatters
|
||||
{
|
||||
/// <summary>
|
||||
/// Camel Case Json Profile Formatter.
|
||||
/// </summary>
|
||||
public class CamelCaseJsonProfileFormatter : SystemTextJsonOutputFormatter
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CamelCaseJsonProfileFormatter"/> class.
|
||||
/// </summary>
|
||||
public CamelCaseJsonProfileFormatter() : base(new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase })
|
||||
{
|
||||
SupportedMediaTypes.Clear();
|
||||
SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/json;profile=\"CamelCase\""));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue