Reading sensors using JSON

JSON, short for JavaScript Object Notation, is a lightweight format for data exchange. JSON is a subset of the literal notation JavaScript object that does not require the use of XML. The simplicity of JSON has led to their widespread use, especially as an alternative to XML in AJAX. One of the supposed advantages of JSON over XML as a data exchange format in this context is that it is much easier to write a parser JSON. In JavaScript, JSON text can be analyzed using the procedure eval(), which has been fundamental to JSON has been accepted by the AJAX developer community because JavaScript ubiquitous on almost any web browser.

Every time there is more support for JSON using third party packages. The list that support these packages are: ActionScript, C, C++, C#, ColdFusion, Common Lisp, Delphi, E, Eiffel, Java, JavaScript, ML, Objective-C, Objective CAML, Perl, PHP, Python, Rebol, Ruby, Lua and VisualFoxPro.

The above definition is taken from Wikipedia and taking into account that JSON as a format is booming in the world of Web Services, Roomba Wi-fi Remote can also be accessed through this XML type of coding with roomba.xml and rwr.xml but with JSON format.JSON files are updated such an XML: values are updated every 500ms (interesting for measuring Distance and Angle).

We have explained several times that the best way to read all the sensors is using the Transparent Mode or Gateway. Remember that it must be done taking into account the Full Mode and Safe Mode described in the specification SCI iRobot Roomba.

roomba.json

The file containing the information in JSON format is roomba.json. This file can be accessed from http://Roomba_Wi-fi_Remote_IP/roomba.json and has exactly same roomba.xml data: A structure called “response” with rX children. One rX for each sensor has a field called “name” defining the iRobotRoomba SCI specification. The field “value” is the last updated value from the automated process of Roomba Remote Wi-fi.