you need change profileNum type like this ,i t can print zero
extends Node2D
var profileNum
var file
var data
var json_data
func _ready():
file = File.new()
file.open("res://save_data.json", File.READ)
data = file.get_as_text()
json_data = JSON.parse(data)
file.close()
profileNum = int(json_data.result["profileNum"])
_onProfileSwitchButton_pressed()
func _onProfileSwitchButton_pressed():
match profileNum:
0:
print("zero")
1:
print("one")
2:
print("two")
3:
print("three")
4:
print("four")
this is json data
{
"profileNum": 0,
}