mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-01-02 13:33:07 +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)!;
|
|
}
|
|
}
|
|
}
|