File was renamed to FileAccess in 4.0, chat gpt gave you old 3.0 code.
Make sure to format your code
I think you will want this
if FileAccess.file_exists("res://close_stars_and_planets.json"):
var file := FileAccess.open("res://close_stars_and_planets.json", FileAccess.READ)
json_data = JSON.parse_string(file.get_as_text())