Get Length of array JSON.Net

Just try this:

var test= ((Newtonsoft.Json.Linq.JArray)json).Count;

You can use below line to get the length of JSON Array in .Net (JArray) .

 int length = ((JArray)test["jsonObject"]).Count;

You can cast the object to a JArray and then use the Count property, like so:

JArray items = (JArray)test["JSONObject"];
int length = items.Count;

You can then loop the items as follows:

for (int i = 0; i < items.Count; i++)
{
    var item = (JObject)items[i];
    //do something with item
}

According to Onno (OP), you can also use the following:

int length = test["JSONObject"].Count();

However, I have not personally confirmed that this will work