I'm having trouble modifying a .json file

Godot Version

Godot 4

Question

Hello.

I’m having trouble modifying a .json file.

Let me describe the issue in more detail. When I read all the text in a scene and switch to another scene, then return to the previous one, the text starts to be typed out again instead of just appearing as it should.

Please help me!

Script:

extends Node2D

var file1 = FileAccess.open("res://text_1/Day_1.json", FileAccess.READ)
var data1 = JSON.parse_string(file1.get_as_text())

var filed = FileAccess.open("res://other/endd.json", FileAccess.READ)
var datad = JSON.parse_string(filed.get_as_text())

var fileq = FileAccess.open("res://questions/question_1.json", FileAccess.READ)
var dataq = JSON.parse_string(fileq.get_as_text())

var txt_speed = 0.00001

# Called when the node enters the scene tree for the first time.
func _ready():
	file1.close()
	filed.close()
	fileq.close()

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
	if datad['global_end']:
		$TXT/Text.text = ""
		$TXT/Text.text = data1['Text']
		$TXT/Text2.text = ""
		$TXT/Text2.text = dataq['Text']
	
	else:
		if !datad['endd1']:
			datad['endd1'] = true
			for i in data1['Text']:
				if !datad['skip1']:
					await get_tree().create_timer(txt_speed).timeout
					$TXT/Text.text += i
				else:
					$TXT/Text.text = ""
					$TXT/Text.text = data1['Text']
		
		if !datad['endd2'] and datad['endd1'] and $TXT/Text.text == data1['Text']:
			datad['endd2'] = true
			for i in dataq['Text']:
				datad['global_end'] = true #Don't work
				if !datad['skip2']:
					await get_tree().create_timer(txt_speed).timeout
					$TXT/Text2.text += i
				else:
					$TXT/Text2.text = ""
					$TXT/Text2.text = dataq['Text']

		if $TXT/Text.text == data1['Text']:
			datad['skip1'] = true
		if $TXT/Text2.text == dataq['Text']:
			datad['skip2'] = true
			if !datad['end_buttons']:
				for i in dataq['Buttons']:
					create_buttons_qest()
			datad['end_buttons'] = true


func _on_skip_pressed():
	if datad['skip1']:
		datad['skip2'] = true
	datad['skip1'] = true

func create_buttons_qest():
	var child = Button.new()
	child.custom_minimum_size = Vector2(250, 100)
	$Button_center/Buttons.add_child(child)

Hello again!

I found a solution to the problem! And it is… drumroll… ConfigFile. As it turns out, it can be easily modified, read, and edited! So, I no longer need a solution.