4.3
extends Node2D
var json_path = “res://Assets/Chart/secret-exit-chart.json”
var chart_data: Dictionary = {}
var TimeLost = 0
func _ready():
load_json_file()
for i in chart_data["notes"].size:
print("hello")
func load_json_file():
#Opens The File To Be Read
var file = FileAccess.open(json_path, FileAccess.READ)
#checks if file is real
assert(FileAccess.file_exists(json_path), “File path does not exist”)
#Reads File
var json = file.get_as_text()
var json_object = JSON.new()
#Parse The Json Object/turn it into data
json_object.parse(json)
#Stores the data in the dictionary we made earlier
chart_data = json_object.data
return chart_data
Question
Im trying to get the array length for a for loop and it is giving me an error saying invalid index size (on base: Dictionary) at line ten which is where the for loop is