I am currently Working on a project, where I save values in a JSON File on an SD Card.
The JSON looks something like this:
{ "ID1":{[[starttime, endtime],
[starttime, endtime],
[...]],
"ID2":{[[starttime, endtime],
[starttime, endtime],
[starttime, endtime],
...],
...
}
I have to add start and endtimes to IDs, so I have to edit the file. Is there a nicer/easier/better way than the following?:
- Create Buffer (e.g. 512 Bytes)
- Read 512 Bytes from file to buffer
- Edit/Add Values in Buffer
- Save Buffer to another File
- Repeat 2. to 4. until end of file
- Remove old File and rename new File
I am currently using the ESP32 Core SD.h Libary