Target Category: Arduino, Delfino, F280x, F281X, Generic MCU, Linux AMD64 and Raspberry Pi, Piccolo, STM32

Target Sub-Category: IoT

Blocks Sub-Category: Extensions > IoT

Description: The JSON block provides an encoding format for translating data into text strings that can be sent and received over the internet.

JSON is used in conjunction with the MQTT blocks to create JSON-formatted text. By using MQTT to send JSON-formatted text to mqttbroker.altairsmartcore.com, you can take advantage of SmartWork’s ability to trigger actions and activate rules that look at the data within the JSON data packet. SmartWorks is an Altair IoT development platform. Output from the JSON block is in the following format:

{“protocol”: “v2”, “checksum”: “”, “device”: “devicename@username.username”, “at”: “now”,“data”: {“Key”: Value}}


Altair SmartWorks Header

Specifies the output format of the JSON block. The ,“device”: specifies the device that is sending the data. For SmartWorks, the value is specified in the following format:


Include Altair SmartWorks JSON Header: When activated, the SmartWorks platform can take actions based on the values of the key pairs.

JSON Syntax Check: Validates the format of the JSON text string.

Key/Value Pairs: Indicates the number of Key/Value input pin pairs on the JSON block. The number you specify is reflected under the Key and Value parameters. Also, when you exit the dialog, the input pins on the block are updated accordingly. You cannot use the Add Connector and Remove Connector commands on JSON blocks.

Packet Byte Size: Specifies the maximum buffer size of the data string. Larger strings are truncated to the maximum buffer size.


See Examples > Blocks > Extensions > IoT.