diff options
| author | crobibero <cody@robibe.ro> | 2020-04-21 08:17:13 -0600 |
|---|---|---|
| committer | crobibero <cody@robibe.ro> | 2020-04-21 08:17:13 -0600 |
| commit | fe632146dcba69edeec56b850736227ff5f4c5b3 (patch) | |
| tree | dfbb04a9570235e220c3a7f9a0d6166709a0cecb /Jellyfin.Server/Models/JsonOptions.cs | |
| parent | c89dc8921ffb0ce11031e9cfb096b525d94e21b3 (diff) | |
Move Json Options to static class for easier access.
Diffstat (limited to 'Jellyfin.Server/Models/JsonOptions.cs')
| -rw-r--r-- | Jellyfin.Server/Models/JsonOptions.cs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Jellyfin.Server/Models/JsonOptions.cs b/Jellyfin.Server/Models/JsonOptions.cs new file mode 100644 index 000000000..fa503bc9a --- /dev/null +++ b/Jellyfin.Server/Models/JsonOptions.cs @@ -0,0 +1,41 @@ +using System.Text.Json; + +namespace Jellyfin.Server.Models +{ + /// <summary> + /// Json Options. + /// </summary> + public static class JsonOptions + { + /// <summary> + /// Base Json Serializer Options. + /// </summary> + private static readonly JsonSerializerOptions _jsonOptions = new JsonSerializerOptions(); + + /// <summary> + /// Gets CamelCase json options. + /// </summary> + public static JsonSerializerOptions CamelCase + { + get + { + var options = _jsonOptions; + options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; + return options; + } + } + + /// <summary> + /// Gets PascalCase json options. + /// </summary> + public static JsonSerializerOptions PascalCase + { + get + { + var options = _jsonOptions; + options.PropertyNamingPolicy = null; + return options; + } + } + } +} |
