using System.Text.Json;

namespace ReportingServices.Shared.HelperClasses
{
    public static class JsonFileHandler
    {
        public static T LoadJSONFile<T>(string file)
        {
            string json = File.ReadAllText(file);
            return JsonSerializer.Deserialize<T>(json);
        }

        public static void SaveJSONFile<T>(T obj, string file)
        {
            string json = JsonSerializer.Serialize(obj);
            File.WriteAllText(file, json);
        }
    }
}
