Updating a single JSON value

I am able to read and use values stored in the SPIFF in a JSON file.

Example lines from JSONconfig:

changeSpeed = json["changeSpeed"]; changeDelay = json["changeDelay"]; maxSpeed = json["maxSpeed"]; ipAddress = json["ipAddress"];

from the JSOn file:

{

"startSpeed":"300", "changeSpeed":"20", "changeDelay":"300", "maxSpeed":"800" }

Can someone provide an example of the code to update one of thoe values.

I tried

json["maxSpeed"] = 850;

In an effort to change the value "maxSpeed" to 850.

I searched alot on the web and could not find any code to update values without having to upload the entire file.

I tried

json["maxSpeed"] = 850;

In an effort to change the value "maxSpeed" to 850.

And? Something happened.

Why do you think you need to change the JSON "file"?

PaulS: And? Something happened.

Why do you think you need to change the JSON "file"?

When I tried that, nothing happened. The value was not updated.

I am trying to see if I write values to JSON file individually without having to upload the entire file.

I am trying to see if I write values to JSON file individually

I’m guessing the problem is on line 57.

I am able to do with this.

int newMaxSpeed = 888;

json.set(“maxSpeed”, newMaxSpeed);

configFile.seek(0, SeekSet);

json.prettyPrintTo(configFile);

It moves the pointer to the beginning of the file and overwrites the file with the change data.

I gotta think there is a better way, i.e not having to rewrite the entire file, but now this works.

It does allow me to change a single value without having to do an upload.