← Madiyar Zhunussov

JSON vs CBOR on an ESP32

WICC 2026, peer-reviewed, with N. A. Balich, F. A. Balich and F. Steinmetz: JSON versus CBOR serialization on an ESP32 at 240 MHz.

Over 50 trials per format, CBOR payloads were 28.2% smaller, and parsing took about 12 µs instead of about 7.8 ms.

WICC 2026, peer-reviewed. N. A. Balich, F. A. Balich, M. Zhunussov, F. SteinmetzPublished

The WICC 2026 poster. The English version keeps the original layout; only the text is translated.
Scroll to read. Esc to close.
The WICC 2026 poster, Comparative Evaluation of JSON and CBOR for Real-Time Industrial IIoT Systems on ESP32 Edge Devices.

The problem

Embedded devices in industrial systems often exchange data as JSON because it is readable and every tool supports it. On a microcontroller that also runs a control loop, though, every millisecond spent parsing a message is a millisecond taken from control. We wanted to know how much JSON actually costs on real hardware, compared with CBOR, a binary format designed for constrained devices.

The setup

What we measured

Measure JSON CBOR
Average payload size 709.8 bytes 509.9 bytes
Average CPU cycles to deserialize 1,875,667 3,015
Average parse time 7,815.5 µs 12.5 µs

The CBOR message was 28% smaller. Parsing it took about 12 µs instead of about 7.8 ms.

Average parsing latency and CPU cycles for JSON and CBOR
Fig. 1. Average parse time (left) and CPU cycles to deserialize (right, logarithmic scale).

What it means

The message got about a quarter smaller, but parsing got hundreds of times cheaper. The bottleneck was not the network. It was the work of turning text back into data on a small processor.

That matters for control loops. At 100 Hz, each cycle has a 10 ms budget. JSON parsing alone used about 78% of it, leaving almost nothing for the control logic. CBOR used about 0.12%.

Parsing one JSON message takes about 7.8 ms, about 78% of the 10 ms cycle.

Fig. 2. One 10 ms cycle of a 100 Hz control loop. The filled part is the time spent parsing one message; the rest is what is left for control. Paper averages.

What I noticed

Across the 50 trials, JSON parse time was not steady. Most trials took about 8 ms, but several came in well under that, between about 5 and 7 ms. CBOR stayed flat at about 12 µs throughout. For a control system, that variation can matter as much as the average, because timing guarantees depend on the worst case.

Parse time for each of the 50 trials, JSON and CBOR
Fig. 3. Parse time across the 50 trials for each format.

What I’d do differently

Test several message shapes and sizes, not one object-detection message. Report the spread (minimum, maximum, p99), not only averages. Measure energy directly instead of inferring it from CPU time. Measure end-to-end latency, including the network, alongside parse time.draft