I am looking to update the state
value in my json data. I am creating a game using HTML and JavaScript, and within my JSON file, I have players with attributes such as name, password, and state.
The task at hand is to specifically target the state
property and change it from 1 to 3 if necessary.
How can I write code that will only modify the player.state
from 1 to 3?
Below is an example of the JSON file:
[
{"pseudo":"player1","password":"player","state":"1"},
{"pseudo":"player2","password":"player","state":"0"}
]