How can i read/write data from new json files?

Hello 🙂 ,

i created a new json file and try to write the data in other variables.

But i have no clue how could it work.

var $dataTest = null;DataManager._databaseFiles.push({ name: '$dataTest', src: 'Test.json'});Game_System.prototype.addTestLine = function(_id) { _field1 = $dataTest[_id].field1;};Console says -> TypeError: Cannot read property '1' of null.

'1' is the _id i commit.

$dataTest in console show me all objects i wrote in the json file, so it's basically available.
Files are loaded asynchronously, so the file probably wasn't loaded, when you tried to access it.
How can i load it in this case?
It will be loaded after "DataManager.isDatabaseLoaded" returns true. This will be after Scene_Boot, so as soon as you see the title screen, your data should be ready.
Arrr, yes! Found the problem.

Should declare it outsite of my iife.. :blush:

Thank you! 😀

Original thread: https://forums.rpgmakerweb.com/threads/how-can-i-read-write-data-from-new-json-files.51319/