Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

fetch.read() to String #78

Closed
Eisbaeeer opened this issue Feb 7, 2021 · 1 comment
Closed

fetch.read() to String #78

Eisbaeeer opened this issue Feb 7, 2021 · 1 comment

Comments

@Eisbaeeer
Copy link
Contributor

Eisbaeeer commented Feb 7, 2021

Hi.
Your example show´s how to get your fetch to a serial.write output. Is there an example to get the response to a string value or are you able to give me a hint to get the Serial.write to String?
My target is to serialize.json the response of a https get. I don´t get the String from Serial.write(fetch.read()); to a string variable.

` Serial.println(ESP.getFreeHeap());

    fetch.GET("https://www.google.com");

    while (fetch.busy())
    {
        if (fetch.available())
        {
            Serial.write(fetch.read());           
        }
    }
    
    fetch.clean();`
@Eisbaeeer
Copy link
Contributor Author

String line = fetch.readString(); Serial.println(line);
done the job.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant