json.save(file, value)
Encode a Lua value to a JSON representation string and save it to a file.
Parameters
file
A File object or a filename string, representing the file to save the JSON data.
value
Lua value to be encoded.
Return value
Returnstrue
or false
in case of error.
Example
local json = require "json"
local t = {name = "John", age = 30, car = "null"}
-- save table content to a file as JSON, should be {"name":"John", "age":30, "car":null}
json.save("test.json", t)