Game Data
Location of User Directory
The location of user:// for Windows is:
C:\Users\<user>\AppData\Roaming\Godot\app_userdata\<project>Read From a JSON File
Create JSON File
Create a JSON file called data.json in your Godot Projects res://data with the following data:
Disclaimer - Normally it is not a good idea to store Player data in the res:// directory as it is read only when exported.
{
"players": {
"PLAYER_1": {
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"favorite_video_games": [
"Super Mario",
"Zelda"
]
},
"PLAYER_2": {
"first_name": "Jane",
"last_name": "Doe",
"email": "[email protected]",
"favorite_video_games": [
"Sonic",
"Starcraft"
]
},
"PLAYER_3": {
"first_name": "Jill",
"last_name": "Smith",
"email": "[email protected]",
"favorite_video_games": [
"Kirby",
"World of Warcraft"
]
}
}
}Create GD Script
Create an data.gd GD Script in res://scripts/data with the following code:
Auto Load Import Data GD Script
Go to Project > Project Settings > Autoload and import the data.gd:

Create Demo Scene and Script
Create a Demo.tscn and attach a Demo.gd GD Script in res://scenes/demo.
Have Demo.gd contain the following code:
Play the Scene
You should see the following Output in the Console:
Save and Load Character Data From a JSON File
Create Character Class
Create a character.gd GD Script in res://classes with the following code:
Create SaveGameAsJSON Class
Create a saveGameAsJSON.gd GD Script in res://classes with the following code:
Create DemoSaveLoad Scene and Script
Create a DemoSaveLoad.tscn and attach a DemoSaveLoad.gd GD Script in res://scenes/demo.
Have DemoSaveLoad.gd contain the following code:
Test Code
If you put a break point after the sg.write_savegame(character) and run the code…

…you can see that the save.json is initially created with the new character data…

… and then after continuing the code you can see the values change and save from the LEVEL UP…

…you will also see the following in the console:
Last updated