aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/Models/JsonOptions.cs
blob: 2f0df3d2c71282d3e9cd67fe23c9f5165517a2b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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();
    }
}