Hi all, First post here. I'm trying to translate some of my code from GD to C#. I had a JSON file loaded on the fly, parsed and iterated, and I'm trying to do the same thing with C#. This is what I what so far:

file.Open("res://Resources/missions.json", 1);
string text = file.GetAsText();
JSONParseResult dict = JSON.Parse(text);
file.Close();

if(dict.Error != 0){
	GD.Print("Error:", dict.ErrorLine);
}else{
	Array parsed = dict.Result as Array;
	GD.Print(parsed.GetValue(0));
}

How can I iterate this "parsed" array and access string ids?

It contains a JSON like

[{
     	"board": {
         "type": 6,
         "floor": 2,
         "wall": 5,
         "pavement": 2
    }, ...]

and it prints ok to the console like. (board:(floor:2), (pavement:2), (type:6), (wall:5))

Any clue?

Thanks in advance

Ok, here's how I made it to access data elements, in case it's useful to someone else later

using System.Collections;
using System.Collections.Generic;
.
.
.

file.Open("res://Resources/missions.json", 1);
string text = file.GetAsText();
JSONParseResult dict = JSON.Parse(text);
file.Close();
if(dict.Error != 0){
	GD.Print("Error:", dict.ErrorLine);
}else{
	Array parsed = dict.Result as Array;
	var nodeStage = parsed.GetValue(0) as Dictionary<object, object>;
	var boardNode = nodeStage["board"] as Dictionary<object, object>;
	boardSize = boardNode["type"];
	GD.Print(boardSize); // Prints 6
}

Thanks anyway

5 years later