/// <summary>
/// Deserialize json string in file to specified object
/// </summary>
/// <typeparam name="T">Specified object type</typeparam>
/// <param name="filepath">Path to text file contained json string</param>
/// <returns></returns>
public static T DeserializeJsonFromFile<T>(string filepath)
{
T obj;
using (var reader = new StreamReader(filepath))
{
using(var jsonReader = new JsonTextReader(reader))
{
var serializer = new Newtonsoft.Json.JsonSerializer();
obj = serializer.Deserialize<T>(jsonReader);
}
}
return obj;
}