I'm using Newtonsoft JSON Converter to deserialize some JSON text, but I have a slight problem, this is that sometimes I get an array of objects returned to me from a web service, and other times it's just a single object, let me give you an example of what I mean:
{ "T":{ "S":"054", "T":"8", "D":"548" } } One is an array whereas the other is just a single object.
{ "T":[ { "S":"054", "T":"8", "D":"548" }, { "S":"054", "T":"8", "D":"548" }, { "S":"054", "T":"8", "D":"548" } ] } When I try to deserialize this using Newtonsoft, I get an error because it's expecting an array and sometimes receives only a single object, is there a way to get around this?