Learn how to parse JSON payloads containing Base64 encoded strings in ArduinoJson v6 and v7, and decode them into raw binary buffers on ESP32, ESP8266, and Arduino.
Frequently Asked Questions
Q1. How do I calculate the decoded byte length from a Base64 string in C++?
The decoded binary byte size is approximately (base64Length 3) / 4. You must subtract 1 byte for each trailing padding "=" character.
Q2. Can I decode binary firmware updates sent over MQTT in JSON with ArduinoJson?
Yes, but for large firmware updates (>10KB), streaming Base64 in chunks or using raw binary HTTP OTA is recommended to avoid exceeding microcontroller RAM.