I have a couple lines to look for a file and create it if needed:
try {
Config = JSON.parse(app.
LoadText("Config"));
} catch {
app
.SaveText("Config",'{"FC1Title":"Please Set","FC2Title":"Please Set","FC3Title":"Please Set","TextSize":"9"}')
Config = JSON.parse(app.LoadText("Config"));
}
Then to save updates, I update the JSON and save it as text:
Config[Title] = result.split(': ')[1].replace('"','')
app.SaveText("Config", JSON.stringify(Config))
Hope it helps.
Tom F