当我不总是将数组传递给它时,如何使JsonConvert.DeserializeObject <T>()解析数组?

我的ASP.Net应用程序中有一个方法如下:

Method1<T>(String inputString)
{
  return JsonConvert.DeserializeObject<T>(inputString);
}

I pass stringified objects to Method1, and one of them is a stringified version of this object:

obj1: {
  a: ...
  b: [...]
}

ie. obj1 is an object that has an array as a property. Now, as is, JsonConvert.DeserializeObject<T>(inputString) won't parse the array part of this object. I learned from this post that I could make this work if type1 were the type of obj1 and I did JsonConvert.DeserializeObject<type1>(inputString). The problem is that I'll be passing stringified versions of a variety of different types of objects to Method1, so I don't know how else to do it than with <T>.

有谁知道我该怎么办?