parent
c89dc8921f
commit
fe632146dc
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue