45 (104)
9
JSON
9.1
General Information
JSON is an acronym for JavaScript Object Notation and an open standard format for storing
and exchanging data in an organized and intuitive way. It is used as an alternative to XML, to
transmit data objects consisting of attribute - value pairs between a server and a web applica-
tion. JavaScripts are used to create dynamic web pages to present the values.
JSON is more versatile than SSI in that you not only can change the values on a web page, but
also the size and the look of the web page dynamically. A simple example of how to create a
web page is added at the end of this chapter.
JSON requests shall be UTF-8 encoded. The module will interpret JSON requests as UTF-8 en-
coded, while all other HTTP requests will be interpreted as ISO-8859-1 encoded. All JSON re-
sponses, sent by the module, are UTF-8 encoded, while all other files sent by the web server
are encoded as stored in the file system.
9.1.1
Access
The JSON resources should be password protected. Add password protection by adding a file
called web_accs.cfg in the root directory.
9.2
JSON Objects
9.2.1
ADI
info.json
GET adi/info.json[?callback=<function>].
This object holds data common to all ADIs that are static during runtime. Optionally, a callback
may be passed to the GET-request for JSONP output.
Name
Data Type
Note
dataformat
Number
0 = Little endian
1 = Big endian
(Affects value, min and max representations)
numadis
Number
Total number of ADIs
webversion
Number
Web/JSON API version
JSON object layout:
{
"dataformat": 0,
"numadis":
123,
"webversion": 1
}
Anybus
®
CompactCom
™
40 Common Ethernet Design Guide
HMSI-27–269 2.1