1

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?:

  1. Create Buffer (e.g. 512 Bytes)
  2. Read 512 Bytes from file to buffer
  3. Edit/Add Values in Buffer
  4. Save Buffer to another File
  5. Repeat 2. to 4. until end of file
  6. Remove old File and rename new File

I am currently using the ESP32 Core SD.h Libary

Markus
  • 11
  • 1

0 Answers0