I have a big JSON string I receive from a third-party library (so, I'm unable to change its format). I deserialize it using JsonConvert.DeserializeObject. Then, two properties of this newly created object are: JObject and its corresponding System.Type. So, I need to implement the method below to parse it to System.Object of known at runtime System.Type.
object ConvertJObjectToObject(Type t, JObject o)
{
return ........
}
JObject.ToObject is a generic method and works only with compile-type types. JsonConvert.DeserializeObject requires JSON string as its first argument, but I have parsed JObject on this stage, and do not want to call ToString() on JObject.
Is there any elegant way to accomplish this?