I\'m trying to use JSON.Net to deserialize a JSON object into a C# object.
The object I want to create is MonthlyPerformance
which contains a list of
This is what I use for JSON deserialization...
using System.Web.Script.Serialization;
namespace blahblah
{
public partial class AccessTierService : ServiceBase
{
public static T ia_deserialize_json(string json_string)
{
try
{
if ((String.Compare(json_string, null) == 0) ||
(String.Compare(json_string, "") == 0) ||
(String.Compare(json_string, String.Empty) == 0))
{
return default(T);
}
JavaScriptSerializer serializer = new JavaScriptSerializer();
return (T)serializer.Deserialize(json_string);
}
catch (Exception)
{
return default(T);
}
}
}
}
and to call it...
login_request = ia_deserialize_json(body_string);