Hello, I am trying to read data from a json file, then have entry from that file display it into a Label so far I am unsuccessful. Below is my json file and below that is the code I am using. please help?
{
"1": {
"id": 1,
"name": "Warlord",
"series": 1,
"mana": 2,
"descr": "Attack is straight forward, so is Defense.",
"attack": 3,
"defend": 2
},
"2": {
"id": 2,
"name": "Crusher",
"series": 1,
"mana": 4,
"descr": "Attack is a major strength of the character.",
"attack": 8,
"defend": 2
},
"3": {
"id": 3,
"name": "Max",
"series": 1,
"mana": 4,
"descr": "A very powerful character for attacking and defending.",
"attack": 7,
"defend": 7
}
}
var file = File.new()
file.open("res:/TradingCardGame.json", file.READ)
var json = file.get_as_text()
var json_result = JSON.parse(json)
file.close()
get_node("Label").set_text(json_result[["1"]["name"][1]])