'Newtonsoft.Json.JsonReaderException: Error reading JObject from JsonReader. Current JsonReader item is not an object: Integer c#

I got an issue that is similar to Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray. Path '', line 1, position 1

I show you my json

var json = "{ 
  \"0\": { 
    \"url\": \"\", 
    \"name\": \"\"
  }
}";

var obj = JObject.Parse(json); // get error

When I try to parse this string using JObject.Parse(); I got the following error :

Newtonsoft.Json.JsonReaderException: Error reading JObject from JsonReader. Current JsonReader item is not an object: Integer

I can't use JsonConvert.DeserializeObject<Class>(json); because I can't create a class with this structure.

How can I resolve this issue ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source