How to fix ArduinoJSON: error: 'DynamicJSONDocument' was not declared in this scope

Problem:

While trying to compile your project, you see an error message like

error: 'DynamicJSONDocument' was not declared in this scope

Solution

The Json in DynamicJsonDocument must be spelled camel case: Json, not JSON! The correct spelling is DynamicJsonDocument.

If that does not help, ensure

#include <ArduinoJson.h>

is at the top of the file where the error occurs.