using TINK.Repository.Exception;
namespace TINK.Repository.Response
{
public static class JsonConvertRethrow
{
///
/// Deserializes COPRI responses in a consitent way for entire app.
///
/// Type of object to serialize to.
/// JSON to deserialize.
/// Deserialized object.
public static T DeserializeObject(string response)
{
try
{
return Newtonsoft.Json.JsonConvert.DeserializeObject(response);
}
catch (System.Exception ex)
{
throw new DeserializationException(ex);
}
}
public static string SerializeObject(object value) => Newtonsoft.Json.JsonConvert.SerializeObject(value);
}
}