JSON C/C++ Library for IoT Communication

JSON has become a popular inter-process communication (IPC) data interchange format for a variety of computer languages. Our open source JSON library for Internet of Things (IoT) is optimized for resource constrained systems including bare metal microcontrollers. The library enables real time parsing of JSON objects on a data stream such as raw sockets. JSON is the fat free alternative to XML and is ideally suited for Machine to Machine communication.

JSON for IoT Communication

The JSON parser is designed to parse data on a stream and provides for the detection of new JSON packets as they trickle in. Use of the JSON library is most beneficial for designs that implement a raw TCP/IP connection for streaming JSON packets. The JSON library does not require frame based packet management and works with a direct raw TCP/IP stream.

Use cases include, but are not limited to:

  • Encode/decode messages sent on a continuous data stream such as on a raw TCP/IP connection.
  • Encode/decode messages sent via an MQTT or SMQ topic.
  • Encode/decode messages sent on a WebSocket connection.
  • Encode/decode messages sent/received via RPC protocols such as HTTP.

Download:

Installing JSON Demo on Android (ARM CPU)

The JSON demo for Android is a bit tricky to download and run since you must run it from a command line shell such as from the Android ADB debugger shell. The following procedure shows how to run it via BusyBox, a free Android terminal.

  1. Install BusyBox for Android.
  2. Start the Terminal Emulator via BusyBox (will be installed if it's not already installed).
  3. Make sure you have the BusyBox PATH environment variable set. You can test this by typing wget in the console. You should see wget printing out some information.
  4. Copy Paste on AndroidUsing the Android's browser, copy the command sequence below. To copy, click the text to activate it and then click and hold until you see the copy icon in Android. Click the select all button if the text is not selected (blue) before clicking the copy button (red).
  5. Paste the command sequence into the Terminal Emulator window started via BusyBox and press enter.
Copy the installation command sequence:
cd; wget realtimelogic.com/downloads/examples/android/m2mled; chmod 777 m2mled; ./m2mled

You should see the following being printed in the terminal window after pasting the above command sequence into the shell.

Connecting to realtimelogic.com (204.15.132.60:80)
m2mled               100% |*******************************| 58768   0:00:00 ETA
Connecting to realtimelogic.info...
Set LED from keyboard. Uppercase = ON, lowercase = OFF.
Switching LED state updates UI in all connected browsers.
Browse to: http://realtimelogic.info/IoT/led/json/
Set LED 1 on
Set LED 2 on
Set LED 3 on
Set LED 4 on

The JSON library is typically used in memory constrained Edge Nodes together with the SMQ C library. The following video shows how you can setup your own low cost IoT cloud server by using the SMQ protocol.

Barracuda IoT Server

Try the Barracuda IoT Server by downloading your own copy or try our online interactive tutorials.