Page 1 of 1

Array of settings - how to read it from SPIFF

Posted: Mon Jun 08, 2020 12:10 pm
by mitiay
Dear ESP32 professionals,

Please advise on the following topic

1. I have declared the following array of settings

Code: Select all

typedef struct {
  char pin[PIN_LENGHT];
  boolean valid;
  time_t timefrom;
  time_t timetill;
} s_access_pins;


s_access_pins access_pins[NUMBER_OF_PINS];
2. I created and stored in SPIFF file access_pins.json

Code: Select all

{
  "access_pins": [
  	{"pin": "0001-0002", "valid": true, "timefrom": 34, "timetill": 35},
 	 {"pin": "0003-0004", "valid": false, "timefrom": 36, "timetill": 37},
  	{"pin": "0005-0006", "valid": true, "timefrom": 38, "timetill": 39},
  	{"pin": "0007-0008", "valid": false, "timefrom": 40, "timetill": 41},
  	{"pin": "0009-0010", "valid": true, "timefrom": 42, "timetill": 43},
  	{"pin": "0011-0012", "valid": false, "timefrom": 44, "timetill": 45}
]
}

3. Now I need to read it. I tried to use ArduinoJSON lib command copyArray with no luck. I would really appreciate working example of this common task if you could share.

Thank you.

Dima