Save Json
Signature
bool saveJson(string path, table data)
Description
Serializes a table and saves it as a JSON file.
Returns whether the operation was successful (true
) or not (false
).
Arguments
Path
The path of the file to be saved.
Absolute paths are supported and relative paths start from {game}\x64\
.
Data
The contents to serialize and save.
Example
Save Config
local data = {
name = "Vaan",
model = 6488064
}
config.saveJson(config.path .. "/mymod-config.json", data)
Output
{
"model": 6488064,
"name": "Vaan"
}
Notes
Only the following value types are supported: table
, string
, double
, integer
, bool
.
Last updated