What you’ve described can easily be done with global variables — nothing scary like arrays or JSONs is needed.
Just store the collected resources in a couple of variables, like collectedGreenEnergy and collectedFossilFuels.
When the player returns to town, subtract the required amount of energy from those variables and increase the pollutionLevel variable.