JSON (JavaScript Object Notation): united data format for exchanging data
JavaScript Object Notation (JSON) is a platform-independent data transfer format. JSON is popular thanks to its simplicity and human-readability. Its advantages include platform independence and unified format, at the cost of data volume.
JSON controlls the smart power sockets NETIO by transferinf .json file over HTTPs

Compared to XML, JSON is simpler to process and takes up less space.

A JSON data structure can be transferred e.g. in a text file (.json is the usual extension).

 

In the context of NETIO products

NETIO products use a JSON structure for reading and writing as one of the REST APIs. This API can be viewed as a transfer of the netio.json text file over http(s) in either direction. Reading (downloading) the file serves to determine the device status and obtain the measured values. By writing (uploading) the file, output states can be changed. It is not necessary to transfer the entire structure; to switch a single output, it is sufficient to transfer just one data object.

Username and password (for reading or for reading+writing) is passed in the standard http (or https) header. Therefore, passwords are not contained in the netio.json file.

JSON over HTTP(s) is one of the preferred REST API protocols because it is built on top of http. M2M API protocols based on http tend to be the most reliable with respect to enterprise IT environments, security mechanisms, blocked ports etc.

 

How the NETIO JSON M2M API (protocol) works

  1. The device state (sockets ON/OFF + electricity consumption) can be read as the http:// device-IP/netio.json file at the device’s IP address. The netio.json file can be downloaded and the contained data structure displayed using a web browser.
     
  2. Outputs are controlled over the JSON protocol by uploading the netio.json file to the device using http(s) post.
     
  3. To try out the JSON API, end users can utilize various tools and utilities (such as cURL). For testing the JSON M2M API, NETIO users can take advantage of the HTTP(s) file upload tool in the web interface. For a detailed description, see AN21.

 

Integration using JSON M2M API

In professional integration, JSON data are sent as a data stream with the /netio.json access point, instead of transferring text files. In the NETIO implementation of the REST JSON protocol, the same TCP/IP connection to the http server in the device can be used to write to the device and then read the updated output states.

 

Sample JSON object for controlling an output:

{

   "Outputs":[

      {

         "ID":1,

         "Action":1

      }

   ]
}

 

M2M Active Client

Some NETIO products are capable of running Lua scripts in the device. A Lua script can behave as a client that downloads files and controls the communication. This special mode can be used to transfer data in a JSON structure. For details, see M2M Active Client.

 

Protocol specifications and links

>> NETIO specification of the JSON over HTTP(s) protocol: Download page

>> AN21 JSON HTTP(s) protocol to control NETIO 230V power sockets (3x REST API)

JSON HTTPs protocol to control NETIO power sockets

 

Ask for a price or technical parameters

For device testing use name/password demo/demo