Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | backendcoder | |
Old Version | Published before Godot 3 was released. |
I am very new to GODOT and using the latest builds of the version 3 RC of the engine so I don’t feel qualified to post issues to the developers in case I just did not understand how to do stuff.
I load a JSON file that works OK in C# using this function (but nothing that I test with JSON.parse gives me any non-error output) :
func load_data():
# JSON parsing not working!
var file = File.new()
file.open("res://Data/game.json", file.READ)
var json = file.get_as_text()
var json_result = JSON.parse(json)
file.close()
if json_result.error != 0:
print("JSON parse error on line: " + data.error_line)
else:
data = json_result.result
What does your JSON file look like?
literalcitrus | 2018-01-21 22:42
I tested with a variety of JSON text such as: {"a": 1}
The result is error_line 0 and empty error_string.
backendcoder | 2018-01-22 01:00