diff options
| author | crobibero <cody@robibe.ro> | 2020-04-19 18:04:36 -0600 |
|---|---|---|
| committer | crobibero <cody@robibe.ro> | 2020-04-19 18:04:36 -0600 |
| commit | ad67081840ec61085673634795d0b6363f649dbf (patch) | |
| tree | fff2b2c05f156ffb9379db9af0af391c4dc4d7a1 | |
| parent | 16401ec7ae078b2b7c4c65e3792cb4c4159490d2 (diff) | |
add camelCase formatter
| -rw-r--r-- | Jellyfin.Server/Formatters/CamelCaseJsonProfileFormatter.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Jellyfin.Server/Formatters/CamelCaseJsonProfileFormatter.cs b/Jellyfin.Server/Formatters/CamelCaseJsonProfileFormatter.cs new file mode 100644 index 000000000..433a3197d --- /dev/null +++ b/Jellyfin.Server/Formatters/CamelCaseJsonProfileFormatter.cs @@ -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\"")); + } + } +} |
