Skip to content

Instantly share code, notes, and snippets.

@bruchmann
Last active April 6, 2021 18:45
Show Gist options
  • Save bruchmann/18462c9a793ccbb09cf8eb6b9dd920f5 to your computer and use it in GitHub Desktop.
Save bruchmann/18462c9a793ccbb09cf8eb6b9dd920f5 to your computer and use it in GitHub Desktop.
Read a JSON file in GDScript
func read_json_file(path: String):
var file = File.new()
file.open(path, File.READ)
var json_result = JSON.parse(file.get_as_text())
if not json_result.error == OK:
return {} # Silently fail
return json_result.result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment