explaingit

bblanchon/arduinojson

7,156C++Audience · developerComplexity · 2/5Setup · easy

TLDR

ArduinoJson is a lightweight C++ JSON library for microcontrollers like Arduino, ESP32, and Teensy, it reads and writes JSON (and MessagePack) while fitting into the tiny memory constraints of embedded hardware.

Mindmap

mindmap
  root((ArduinoJson))
    What it does
      JSON parsing
      JSON serialization
      MessagePack support
    Supported Boards
      Arduino Uno Mega
      ESP8266 ESP32
      Teensy Particle
    Setup
      Header-only include
      No dependencies
    Audience
      Embedded developers
      Makers and hobbyists
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Parse JSON responses from a REST API on an ESP32 Wi-Fi project.

USE CASE 2

Serialize sensor readings into a JSON string and send them to a server from an Arduino board.

USE CASE 3

Use MessagePack instead of JSON to reduce payload size on a bandwidth-limited embedded connection.

USE CASE 4

Store configuration settings as a JSON file on an SD card and load them at startup.

Tech stack

C++ArduinoESP32PlatformIO

Getting it running

Difficulty · easy Time to first run · 30min

Header-only, just include one file, no separate compiled library or build step needed.

In plain English

ArduinoJson is a JSON library written in C++ for microcontrollers and embedded systems. Microcontrollers, such as those found in Arduino boards, ESP32 chips, and Teensy boards, have very limited memory compared to regular computers, so a JSON library that runs well on them needs to be especially careful about size and memory use. ArduinoJson is designed to meet those constraints while still being straightforward to use. The library handles both reading (deserialization) and writing (serialization) of JSON. You can parse a JSON string to extract values from it, or build a JSON document from variables in your code and convert it to text. It also supports MessagePack, a binary data format that is more compact than JSON and often used in embedded applications where bandwidth or storage matters. Because microcontrollers come in such a wide variety, ArduinoJson has been tested on many different boards: standard Arduino boards (Uno, Mega, Nano), ESP8266 and ESP32 chips common in Wi-Fi projects, Teensy boards, Particle boards, and Texas Instruments MSP430, among others. It is also usable in any standard C++ project, not just Arduino, and works with most embedded development environments including PlatformIO, Keil, IAR, and the Arduino IDE. The library is header-only, which means you add it to your project by including a single file rather than building a separate compiled library. It has no external dependencies, which matters on platforms where pulling in additional code is complicated. Unit test coverage is close to 100%, and the library is continuously tested against multiple compiler versions and fuzzed by Google's OSS Fuzz infrastructure to catch parsing edge cases. Documentation includes tutorials, worked examples, a troubleshooter, an FAQ section, and a paid book for those who want a more thorough guide.

Copy-paste prompts

Prompt 1
I'm using ArduinoJson on an ESP32. Show me how to parse this JSON string from an HTTP response and extract specific fields: {"temp": 23.5, "humidity": 60}.
Prompt 2
My Arduino project uses ArduinoJson to build a JSON document from sensor readings. Help me serialize it and print it to Serial.
Prompt 3
I'm getting a memory error with ArduinoJson on an Uno. Explain what StaticJsonDocument vs DynamicJsonDocument means and how to choose the right size.
Prompt 4
Show me how to use ArduinoJson MessagePack support to pack a sensor reading on an Arduino and unpack it in a Python script.
Open on GitHub → Explain another repo

← bblanchon on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.