JSON C/C++ Library for IoT Communication

Stream JSON Over TCP/IP, UART, WebSocket, and IoT Protocols

The Real Time Logic JSON C library is designed for embedded products that need compact JSON encoding and stream-based parsing. Use it when C or C++ firmware must exchange structured data over raw TCP/IP, UART, WebSocket, MQTT, SMQ, REST, or another transport.

Use the JSON Library When

  • Your C/C++ application must serialize and parse structured IoT data.
  • JSON arrives incrementally over UART, raw TCP/IP, or another stream.
  • You want JSON without adding a larger protocol stack just for message framing.

Get the JSON Library

Incremental Parsing

Parse JSON as bytes arrive instead of buffering a complete document before processing.

Stream Friendly

Use JSON directly over UART and TCP/IP streams when no packet framing is available.

C Structure Mapping

Use APIs that simplify converting between C data structures and JSON messages.

Protocol Agnostic

Use the same JSON encoder and decoder with WebSocket, MQTT, SMQ, REST, or custom transports.

Why Stream-Based JSON Parsing Matters

Many IoT protocols already provide packet framing. WebSocket frames include a size header, MQTT publishes messages by topic, and HTTP APIs define request and response boundaries. In these cases, a conventional JSON encoder or decoder can work on each complete message.

Raw TCP/IP and UART are different. They are byte streams, not message transports, so the application may receive part of a JSON document, several documents, or a document split across multiple reads. The Real Time Logic JSON parser is designed for this environment: it can parse incoming data incrementally and notify the application when a complete JSON message has been assembled.

JSON for IoT communication over multiple transports

Where JSON Fits

Raw TCP/IP and UART

Send and receive JSON over simple streams without inventing delimiters or buffering full messages.

WebSocket and REST

Use JSON as the payload format for browser interfaces, device APIs, and service integrations.

MQTT and SMQ

Encode structured payloads for publish/subscribe protocols such as MQTT and SMQ.

Minnow Server Examples

The JSON library is used in the Minnow Server IoT reference example.

Downloads, Documentation, and Examples

The GitHub repository includes a raw TCP/IP example. After cloning the project, build it and run the m2mled example, then open the companion browser interface to test the connected device.

cd JSON make ./m2mled