Home > Community Toolbox Reference > JSON utilities
Saves a given GML value (struct/array/string/real) into a JSON file.
Argument | Type | Usage | Description |
---|---|---|---|
filename | String |
Required | The path of the JSON file to save. |
value | Any |
Required | The value to save as a JSON file. |
prettyprint | Bool |
Default: false |
Whether to include indentations and newlines for readability (false by default). |
N/A
The following code shows a function to save game data into a JSON file.
function save_location() {
var _save_data = { target_room: room, x: obj_Player.x, y: obj_Player.y };
json_save("save.dat", _save_data);
}
- 23.4.1 - Tweaked the JSDocs.
- 23.4.0 - Created a function to write a given value to a JSON file.