Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Cyber-Kun |
so I have the following script wich downloads a json file from an api:
extends Node
@onready var Http = $Request
@onready var dir = "res://Data/Stage/"
@export var StageURL = "https://developer.sepush.co.za/business/2.0/status"
var file_name = "GlobalStage.json"
var token = "token: *******************************"
var path = 'res://Data/Stage/GlobalStage.json'
@export var headers = PackedStringArray([token])
@export_multiline var request_data: String
func _ready():
$Request.request_completed.connect(Return)
func Request():
$Request.set_use_threads(true)
$Request.request("https://developer.sepush.co.za/business/2.0/status", headers)
print("r1")
func Return(result: int, response_code: int, headers: PackedStringArray, body: PackedByteArray):
var status = JSON.parse_string(body.get_string_from_utf8())
download_file(StageURL, path)
print("shcedule: \n", status)
func download_file(StageURL, path):
$Download.set_download_file(path)
$Download.request(StageURL, headers)
print("file Downloaded")
now when I open the json file in the godot editor all the information in it is on one line
when I open that same file in firefox it is formatted correctly. so I would like to know how to have it not read the file as if everything was on one line and display it in the correct format. I am opening the file in the editor and not reading it through a script.