B.1.8 csijson, B.1.8.1 a short introduction to json, B.1.8 – Campbell Scientific LoggerNet Datalogger Support Software User Manual

Page 508: B.1.8.1

Advertising
background image

Appendix B. Campbell Scientific File Formats

<v6>2006-08-16T06:13:46</v6>

<v7>52.5</v7>

<v8>2006-08-16T22:20:10</v8>

<v9>32.15</v9>

<v10>2006-08-16T10:19:42</v10>

<v11>30.34</v11>

<v12>2006-08-16T15:37:33</v12>

<v13>10.06</v13>

<v14>2006-08-16T05:25:24</v14>

<v15>84.6</v15>

<v16>2006-08-16T04:26:52</v16>

<v17>13.21</v17>

<v18>2006-08-16T17:28:53</v18>

<v19>11.86</v19>

<v20>2006-08-16T14:34:31</v20>

<v21>217.4</v21>

<v22>0</v22>

<v23>2006-08-16T00:02:48</v23>

<v24>0</v24>

<v25>922</v25>

<v26>2006-08-16T12:47:13</v26>

<v27>26.68</v27>

<v28>764.5</v28>

<v29>2006-08-16T10:00:00</v29>

<v30>761.7</v30>

<v31>2006-08-16T18:45:00</v31>

<v32>0</v32>

</r>

</data>

</csixml>

B.1.8 CSIJSON

CSIJSON is a file format that is relatively easy to parse in any language but

more particularly so in JavaScript since it adopts the same syntax rules that are

used for JavaScript object initialization. Its structure is much like CSIXML It is

very easy to digest in a JavaScript or ActionScript (Flash) environment and is

probably the most efficient means of handling CSI generated data in a web

browser context.

The CSIJSON file format is available for some CRBasic instructions including

TableFile and the WebPageBegin/WebPageEnd Format command.

B.1.8.1 A Short Introduction to JSON

Much like XML, JSON is a recursive structure with a root object (represented

by an opening and closing curly brace (‘{‘ and ‘}’). This root object can

contain named strings, numbers, objects, and arrays. A simple object

specification follows:

{

"head": {

"signature": xxxx,

"transaction": "xxxxyyyy",

"environment": {

}

"fields": [

]

},

"data": [ ]

}

This declaration declares an object that contains two empty sub-objects, head,

and data. In a JavaScript program, a string in this format can be easily parsed

using the Eval() function or the newer ParseJSON() function. Once parsed, the

data contained therein can be accessed using standard JavaScript notation.

B-14

Advertising