0 votes

I was able to make an A.P.I that can store information contained in a JSON file but i don't know how to call that information in a different node?

just to be safe heres the code for storing information

extends Node

var data = {}
var path = "res://Json_Files/test_file3.json"

export (String, FILE) var json_file = null

func _ready():

func _API():
    var jsonfile = File.new()
    jsonfile.open(path, File.READ)
    data = parse_json(jsonfile.get_as_text())
related to an answer for: Json file read; but output says null
in Engine by (41 points)

1 Answer

0 votes

Use Singletons. That way you can call that script from anywhere.

by (378 points)
edited by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.