Why ArduinoJson is slow?
First of all, ArduinoJson is not slow by itself. It’s slow when used in conjunction with the WifiClient
from the ESP8266 core.
The problem is that there is no buffer between ArduinoJson and the WifiClient.
To solve this, either:
- Enable the Nagle algorithm on
WifiClient
by callingsetNoDelay(false)
. - Serialize to a buffer and send the whole buffer in one shot.
- Insert a BufferedPrint proxy between ArduinoJson and
WifiClient
.