Reading a Saved File's Switch ID / Variable ID's value

I would like to know how can I read a certain saved file's switches and variables' value. For example, I changed the value of variable 1 to 90. After that, I saved it. On the title screen, I am trying to read that saved file's variables or switches and store it to a value in Game System or Game Temp for example.

My question is, how can I read a certain saved file's specific variable ID / switch ID and store it into another created variable?

Thanks in advance.
var data = JsonEx.parse(StorageManager.load(savefileId));
// data.switches -> switches


// data.variables -> variables

Afterwards, do with it whatever you want.
Yay, thanks, this helped a lot. All I have to do is to loop it to check each and every value to see which switch is turned on 😀
Yay, thanks, this helped a lot. All I have to do is to loop it to check each and every value to see which switch is turned on 😀
If you are looking for a specific switch, and know its ID you can just do

data.switches.value(IDHERE);
To get the value.
Okay here's a problem. What if I want to check a certain switch on ALL existing saved files? How can I do that? Because it throws me an unexpected end of input when a saved file is not existent. So my problem is, how can I check ALL existing saved file's specific switch ID?
Code:
DataManager.loadGlobalInfo();
This gives you an array containing the header (what you can see in the save/load screen) of all existing savefiles.
I see. What is the proper check for this?

Parsing the JSON depends on which index my commands are placed. For example, command1 is switch 1. However, I want to load all existing saved files and load to see if switch value is on.

Will I have to store this 

DataManager.loadGlobalInfo()on a new array? If so, how can I completely loop it to check them individually if such switch is on?

Any help on this is appreciated.

Original thread: https://forums.rpgmakerweb.com/threads/reading-a-saved-files-switch-id-variable-ids-value.53729/