Maybe this helps
you gotta move that enumerator, (you gotta move that color teehveeeeeyyy....)
class Program
{
static void Main(string[] args)
{
string json = "[{\"success\": {\"/a/b/c\": false}}]";
using (var document = JsonDocument.Parse(json))
{
var root = document.RootElement;
var enumerator = root.EnumerateArray();
while (enumerator.MoveNext())
{
Console.WriteLine($"You are now at array element {enumerator.Current}");
var elementContentEnumerator = enumerator.Current.EnumerateObject();
while (elementContentEnumerator.MoveNext())
{
Console.WriteLine($"You are now at property {elementContentEnumerator.Current.Name}");
}
}
Console.ReadLine();
}
}
}
Also: Things to consider when manually parsing through JSONS
There are a lot of powerful JSON Frameworks available for C#. And there are lot of things available, to make the code more fluent. Especially LINQ, which means Language Integrated Query. Have a shot at it.
Most of this make working with JSONS and C# really convenient, etc.
So normally (unless it is a very special thing you are up to) you can say that, whenever you are manually parsing through a JSON, and manually looping through enumerators, like in the code above, you are probably not leveraging the full power of C# and it's libraries.
Please accept as answer when it did help,
Greetings, Mike