WIn_RustTools/RustTools/Helpers/Json.cs

23 lines
482 B
C#
Raw Permalink Normal View History

2024-07-14 11:24:10 +00:00
using Newtonsoft.Json;
2024-07-29 01:10:42 +00:00
namespace RustTools.Helpers;
2024-07-14 11:24:10 +00:00
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);
});
}
}