mirror of
https://github.com/PacktPublishing/Learn-WinUI-3-Second-Edition.git
synced 2026-06-20 12:23:09 +00:00
23 lines
501 B
C#
23 lines
501 B
C#
using Newtonsoft.Json;
|
|
|
|
namespace TemplateStudioSampleApp.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);
|
|
});
|
|
}
|
|
}
|