2020-04-21 08:17:13 -06:00
|
|
|
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
|
|
|
|
|
{
|
2020-04-23 21:41:10 -06:00
|
|
|
var options = DefaultJsonOptions;
|
2020-04-21 08:17:13 -06:00
|
|
|
options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
|
|
|
|
|
return options;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets PascalCase json options.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static JsonSerializerOptions PascalCase
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2020-04-23 21:41:10 -06:00
|
|
|
var options = DefaultJsonOptions;
|
2020-04-21 08:17:13 -06:00
|
|
|
options.PropertyNamingPolicy = null;
|
|
|
|
|
return options;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-04-23 21:41:10 -06:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets base Json Serializer Options.
|
|
|
|
|
/// </summary>
|
|
|
|
|
private static JsonSerializerOptions DefaultJsonOptions => new JsonSerializerOptions();
|
2020-04-21 08:17:13 -06:00
|
|
|
}
|
|
|
|
|
}
|