Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 1.08 KB

File metadata and controls

34 lines (23 loc) · 1.08 KB

Home > Community Toolbox Reference > JSON utilities

json_save

Go to source

Saves a given GML value (struct/array/string/real) into a JSON file.

Arguments
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).
Returns

N/A

Example

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);
}

Update history

  • 23.4.1 - Tweaked the JSDocs.
  • 23.4.0 - Created a function to write a given value to a JSON file.