diff options
| author | Cody Robibero <cody@robibe.ro> | 2020-04-29 07:38:18 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-29 07:38:18 -0600 |
| commit | d491b1b45fc813cb3bd1fe87918f693897621555 (patch) | |
| tree | 4bb52a35e9cd7cd0326c6c89d80b5349b3dfee0a /Jellyfin.Server/Models/JsonOptions.cs | |
| parent | 068368df6352cfad4e69df599c364b3f05b367ba (diff) | |
| parent | 2cb0f6f1263cabee288ab30109b55c57e24c7ed0 (diff) | |
Merge branch 'api-migration' into redoc
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..2f0df3d2c --- /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> + /// Gets CamelCase json options. + /// </summary> + public static JsonSerializerOptions CamelCase + { + get + { + var options = DefaultJsonOptions; + options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; + return options; + } + } + + /// <summary> + /// Gets PascalCase json options. + /// </summary> + public static JsonSerializerOptions PascalCase + { + get + { + var options = DefaultJsonOptions; + options.PropertyNamingPolicy = null; + return options; + } + } + + /// <summary> + /// Gets base Json Serializer Options. + /// </summary> + private static JsonSerializerOptions DefaultJsonOptions => new JsonSerializerOptions(); + } +} |
