Skip to content

ESP32-HTTP-Client

A fluent, object-oriented HTTP client for ESP32 that binds JSON response fields directly into your variables — no ArduinoJson, no intermediate strings, no boilerplate.

Language Coverage License Stars


What is it?

ESP32-HTTP-Client is a lightweight Arduino library for the ESP32 that rethinks how you interact with REST APIs. Instead of fetching a raw JSON string and then parsing it, you simply tell the client where to put the data, it handles the rest.

int userId;
float temperature;
char city[32];

client.get("/report")
      .getBody("userId", &userId)
      .getBody("sensor.temp", &temperature)
      .getBody("0.address.city", city, sizeof(city));

One fluent chain. Direct memory binding. Zero heap allocations for the response.

How it Works

sequenceDiagram
    box rgba(0, 150, 136, 0.15) ESP32 Device
    participant App as Your App
    participant Client as ESP32HTTPClient
    end
    box rgba(255, 152, 0, 0.15) External API
    participant Server as API
    end

    App->>Client: 1. Configure Request & Bind Variables
    Note over App,Client: e.g., getBody("temp", &temperature)
    Client->>Server: 2. Send HTTP Request
    Server-->>Client: 3. Stream JSON Response

    rect rgba(0, 150, 136, 0.1)
    loop Zero-Allocation Parsing
        Client->>Client: Read Stream Byte-by-Byte
        Client->>Client: Identify Keys On-The-Fly
        rect rgba(255, 152, 0, 0.15)
        alt Key Matches Target
            Client->>App: 4. Inject Value directly into Variable
        end
        end
    end
    end
    Client-->>App: 5. Request Complete

Performance at a Glance

Benchmarked over 100 consecutive HTTP GET requests with JSON payloads on a real ESP32 device:

Metric Standard (HTTPClient + ArduinoJson) ESP32-HTTP-Client
Heap allocation per request ~58.2 KB ~15 bytes
Average RAM footprint 34.2% 24.3%
Minimum free heap 114.3 KB 128.6 KB
Average execution time ~750 ms ~59 ms

See the full performance analysis


Quick Install

Search for ESP32-HTTP-Client in the Arduino IDE Library Manager and click Install.

Download the latest release and place the folder inside your Arduino/libraries/ directory.

Full installation guide


30-Second Quick Start

#include <WiFi.h>
#include "ESP32HTTPClient.h"

ESP32HTTPClient client("https://jsonplaceholder.typicode.com");

void setup() {
    Serial.begin(115200);
    WiFi.begin("YOUR_SSID", "YOUR_PASSWORD");
    while (WiFi.status() != WL_CONNECTED) delay(100);

    int userId = 0;

    // API returns: { "userId": 1, "id": 1, "title": "...", "completed": false }
    client.get("/todos/1").getBody("userId", &userId);

    Serial.printf("User ID: %d\n", userId);
}

void loop() {}

See all examples


If this library saved you time, consider leaving a ⭐ on GitHub.