Hello,
to turn the content of a JSON file into a godot variable you can use the global parse_json
function:
func read_json_file(file_path):
var file = File.new()
file.open(file_path, File.READ)
var content_as_text = file.get_as_text()
var content_as_dictionary = parse_json(content_as_text)
return content_as_dictionary
For your problem I would use the same data structure in the JSON file and in the dictionnary, that is to say formatting the JSON file this way so that there is no conversion needed:
{
"word_1_en" : ""
"word_1_de" : ""
"word_2_en" : ""
"word_2_de" : ""
}
Finally, it looks like your a trying to use a custom solution to handle translations.
In case you didn't know, godot has tools to support that, see the relevant docs.