I have a process that needs to be able to call on a function in the following manner.
public static Task Convert(string payload, Type type)
{
You do not need to jump through hoops. JsonConvert.DeserializeObject has a non-generic overload that accepts a Type
.
public static Task<string> Convert(string payload, Type type)
{
JsonSerializerSettings settings = new JsonSerializerSettings().Configure();//<--- Pull in extension methods to handle custom types
return JsonConvert.SerializeObject(JsonConvert.DeserializeObject(payload, type), settings));
}