Topic was automatically imported from the old Question2Answer platform.
Asked By
Sinowa-Programming
I have been working on an risk style game with custom style provinces and i can’t seem to find a way to read and retrieve the province name from my .json file. Any help is welcome.
var test := {
"prov0": "(194, 193, 102, 175)",
"prov1": "(135, 205, 101, 93)",
"prov2": "(222, 0, 248, 115)",
"prov3": "(174, 220, 157, 27)"
}
var json := to_json(test)
var dictionary : Dictionary = JSON.parse(json).result
for i in dictionary.keys():
print("%s : %s" % [i, dictionary[i]])
# also works without quote for value
print(dictionary.prov0)
print(dictionary.prov1)
print(dictionary.prov2)
print(dictionary.prov3)