JSON/Dictionary Array - unexpected behavior

Godot 4.2.1

Loaded JSON from a file:

var jsonStr := FileAccess.get_file_as_string(json_path)
var jsonData: Dictionary = JSON.parse_string(jsonStr)

This is the content of the JSON file:

{
	"metaX": "metaX value",
	"filters": [
		{
			"name": "someName_1_1",
			"filters": [
				{
					"name": "someName2_1",
					"items": [
						"thing3_1_1",
						"thing3_1_2"
					]
				},
				{
					"name": "someName2_2",
					"items": [
						"thing3_2_1",
						"thing3_2_2"
					]
				}
			]
		},
		{
			"name": "someName_1_2",
			"filters": [
				{
					"name": "someName2b_1",
					"items": [
						"thing3b_1_1",
						"thing3b_1_2"
					]
				},
				{
					"name": "someName2b_2",
					"items": [
						"thing3b_2_1",
						"thing3b_2_2"
					]
				}
			]
		}
	]
}

Grabbing the first “filters” key/val and it returns a typeOf = Array:

var filterArr: Array = jsonData["filters"]

Expected behavior seems like ‘filterArr’ would have two Dictionary objects. (someName_1_1 and someName_1_2)

Instead, I get size=3 – typeOf is Dictionary, Dictionary, String.

filterArr contains the descendant objects starting with someName_1_1 instead of the sibling objects.

When I loop over the array and print to the console, I get:

{ "name": "someName_1_1", "desc": "someDesc_1_1", "filters": [{ "name": "someName2_1", "desc": "someDesc2_1", "items": ["thing3_1_1", "thing3_1_2"] }, { "name": "someName2_2", "desc": "someDesc2_2", "items": ["thing3_2_1", "thing3_2_2"] }] }
{ "name": "someName2_1", "desc": "someDesc2_1", "items": ["thing3_1_1", "thing3_1_2"] }
thing3_1_1

It’s like it grabbed the first object of each descendant.

This is weird, right? Am I using this incorrectly? Is there a bug with Dictionary?

Ignore all of this.

I completely forgot that I had a recursive call as the last line of the for-loop. (the code generates a filter tree, so it follows each branch down to a leaf) Because I had changed the structure of the data, there was an ‘else’ recursive call that was assuming a different typeOf. So, overall, my main array was size 2. The additional logging was from the recursive calls. It was failing within the loop when trying to assign a String to a Dictionary. (the ‘items’ array in the the JSON above)