- Fri Jan 18, 2019 4:26 am
#80132
QuickFix wrote:Somehow your failing code was magically erased from the forum, please post it again.
1° Test:
File f = SPIFFS.open("/f.xml", "w");
http.begin(Link);
httpCode = http.GET();
if ((httpCode==200)){
f.println(http.getString());
f.close();
f = SPIFFS.open("/f.json", "r");
if (!f) {
Serial.println("file open failed");
}
String s1=f.readString();
Result 1°Test: httpCode=200 ( OK) but the string s1 it's empty. If I download a small file the string s1 it's ok.
2° Test:
File f = SPIFFS.open("/f.json", "w");
// if (f) {
http.begin(Link);
httpCode = http.GET();
if (httpCode > 0) {
if (httpCode == HTTP_CODE_OK) {
unsigned long t=millis();
http.writeToStream(&f);
unsigned long tempo=millis()-t;
Serial.print("tempo impiegato=");Serial.println(tempo);
delay(50);
f.close();
f = SPIFFS.open("/f.json", "r");
String s;
for (int i=1; i<=11000; i++){
s=f.readStringUntil(',');
}
f.close();
}
}
http.end();
Result 2°Test: httpCode=200 ( OK) and I can read all.
So, I could use the 2° code and download the entire file but How Can I do the parse json file?