You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
none of my implementation is working, what I'm doing wrong ?
And here below my reading implementation on ESP8266 SPIFFS
/* ======================================================================Function: read_config_gatewayPurpose : read json gateway config fileInput : -Output : true if config ok, false otherwiseComments: -====================================================================== */boolread_config_gateway(void)
{
constchar cfg_file[] = "/cfg_gateway.json";
bool ret = false;
size_t size = check_config_file(cfg_file);
if ( size ) {
File configFile = SPIFFS.open(cfg_file, "r");
// Allocate a buffer to store contents of the file.
std::unique_ptr<char[]> buf(newchar[size]);
// We don't use String here because ArduinoJson library requires the input// buffer to be mutable. If you don't use ArduinoJson, you may as well// use configFile.readString instead.if ( configFile.readBytes(buf.get(), size) == size ) {
DynamicJsonBuffer jsonBuffer;
JsonObject& json = jsonBuffer.parseObject(buf.get());
if (json.success()) {
constchar* data ;
uint16_t mode = 0;
mode = json["gateway"]["rgb_luminosity"];
if (mode) {
Debugf("JSON set RGB Luminosity to %d%%\r\n", mode);
rgb_luminosity = mode;
}
mode = json["gateway"]["rgb_led_type"];
if (mode) {
Debugf("JSON set RGB LED Type to %d\r\n", mode);
rgb_led_type = (RgbLedType_e) mode;
}
// All is fine
ret = true;
} else {
DebuglnF("Failed to parse file");
}
} else {
DebuglnF("Failed to read file content");
}
if (configFile) {
configFile.close();
}
}
return ret;
}
Each time I got this output
SPIFFS Mount succesfull
FS File: /cfg_wifi.json, size: 111
FS File: /cfg_module.json, size: 808
FS File: /index.htm, size: 4072
FS File: /edit.htm, size: 17179
FS File: /cfg_gateway.json, size: 191
file /cfg_wifi.json looks good (111 bytes)
JSON override SSID '' to 'CH2I-HOTSPOT'
JSON override PSK '' to '********'
file /cfg_gateway.json looks good (191 bytes)
Failed to parse file
The text was updated successfully, but these errors were encountered:
hallard
changed the title
Parsing error with comment
Parsing error with comment on json file
Jan 16, 2017
Docs mention that comments are allowed in 2 formats
or
but as soon as I put comment I can't parse file (from ESP8266 SPIFFS), when I remove them, all is fine, I tried
none of my implementation is working, what I'm doing wrong ?
And here below my reading implementation on ESP8266 SPIFFS
Each time I got this output
The text was updated successfully, but these errors were encountered: