WIn_RustTools/RustTools.Core/Helpers/Json.cs
2024-07-14 19:24:10 +08:00

23 lines
487 B
C#

using Newtonsoft.Json;
namespace RustTools.Core.Helpers;
public static class Json
{
public static async Task<T> ToObjectAsync<T>(string value)
{
return await Task.Run<T>(() =>
{
return JsonConvert.DeserializeObject<T>(value);
});
}
public static async Task<string> StringifyAsync(object value)
{
return await Task.Run<string>(() =>
{
return JsonConvert.SerializeObject(value);
});
}
}