This repository was archived by the owner on Jan 20, 2025. It is now read-only.

Description
Hi
I'm new to esp can some one give an example, on how to make a rest endpoint and parse json.
i tried running the sample code
#include "AsyncJson.h"
#include "ArduinoJson.h"
AsyncCallbackJsonWebHandler* handler = new AsyncCallbackJsonWebHandler("/rest/endpoint", [](AsyncWebServerRequest *request, JsonVariant &json) {
JsonObject& jsonObj = json.as<JsonObject>();
// ...
});
server.addHandler(handler);
But this just gives me a compile error
JsonObject& jsonObj = json.as<JsonObject>();
^
exit status 1
invalid initialization of non-const reference of type 'ArduinoJson::JsonObject& {aka ArduinoJson6120_000001::ObjectRef&}' from an rvalue of type 'ArduinoJson6120_000001::enable_if<true, ArduinoJson6120_000001::ObjectRef>::type {aka ArduinoJson6120_000001::ObjectRef}'