Created
August 8, 2022 20:19
-
-
Save tonytins/8f9f76f09bfed3963720b3c3e6afd26e to your computer and use it in GitHub Desktop.
JSON Helper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends Node | |
func key_value(json_path, json_file, key, is_dictionary = false): | |
var file = File.new() | |
var full_path = str(json_path + json_file); | |
if file.file_exists(full_path): | |
file.open(full_path, File.READ) | |
var result = parse_json(file.get_as_text()) | |
if is_dictionary == true: | |
result.clear() | |
return result[key] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment