I am using .net web api to get json and return it to the front end for angular. The json can be either an object or an array. My code currently only works for the array not
Using Json.NET, you could do this:
string content = File.ReadAllText(path); var token = JToken.Parse(content); if (token is JArray) { IEnumerable phones = token.ToObject>(); } else if (token is JObject) { Phone phone = token.ToObject(); }