Hi,
I’m just messing around with some JSON. I am able to get data from a JSON file into my game via a custom resource, and then convert that into a lua table and vice versa with json.encode() and json.decode(). However, im struggling to write an edited JSON string back to the JSON file. So what im asking is, how do i write JSON strings back to my custom resource that i used in the first place? All the help i can get would be much appreciated!
This is my code, everything is outputting with no errors:
--test
json = require "json"
local test_json_file = sys.load_resource("/res/json/Database.json")
local test = json.decode(test_json_file)
pprint(test)
local tbl = {
UserData = {
{Password = "pass"},
{username = "user"}
}
}
local testtbl = json.encode(tbl)
pprint(testtbl)```