How to check if value exists in ArduinoJSON
Option 1: Use containsKey()
if(doc.containsKey("speed")) {
float value = doc["speed"];
} else {
// Speed does not exist
}
Option 2: Use default values
// If doc["speed"] does not exist, speed will be NaN
float speed = doc["speed"] | nanf(nullptr);
if(speed != nanf(nullptr)) {
// TODO do something with speed
}