mirror of
https://github.com/codex-storage/cs-codex-dist-tests.git
synced 2025-02-23 09:18:35 +00:00
28 lines
836 B
C#
28 lines
836 B
C#
using Newtonsoft.Json;
|
|
using System.Globalization;
|
|
|
|
namespace OverwatchTranscript
|
|
{
|
|
public static class Json
|
|
{
|
|
private static JsonSerializerSettings settings = new JsonSerializerSettings
|
|
{
|
|
Formatting = Formatting.None,
|
|
NullValueHandling = NullValueHandling.Ignore,
|
|
Culture = CultureInfo.InvariantCulture,
|
|
DateFormatHandling = DateFormatHandling.IsoDateFormat,
|
|
FloatFormatHandling = FloatFormatHandling.Symbol
|
|
};
|
|
|
|
public static string Serialize(object obj, Formatting formatting = Formatting.None)
|
|
{
|
|
return JsonConvert.SerializeObject(obj, formatting, settings);
|
|
}
|
|
|
|
public static T Deserialize<T>(string json)
|
|
{
|
|
return JsonConvert.DeserializeObject<T>(json)!;
|
|
}
|
|
}
|
|
}
|