JSON Data Formats

All MQTT messages are transmitted as JSON-formatted text. Supported formats include: GEOJSON, CSIJSON, and BASICJSON.

Due to data logger memory constraints, individual messages are limited to approximately 4 KB in size. If a DataTable record exceeds this limit, a compile-time error will be generated. In such cases, consider redesigning your data layout by using multiple DataTables to split the data into smaller, manageable parts.

Note

CR1000X OS 8.3.0 and CR6 OS 14.3.0, All supported JSON formats are transmitted in compact form without whitespace. The examples below include indentation and whitespace (pretty-printed) for readability.

GEOJSON Output Format

CSI GEOJSON is an adaptation of the GEOJSON open standard data format. This format is less verbose than the CSI-JSON format and allows multiple observations to be compactly transmitted in a single JSON payload. In the CSI version of GEOJSON the observationNames are in an array which match fields stored in data tables. The corresponding location in the array is the same location in the values array where the observation value is located.

Note

GEOJSON is the required format when the data endpoint is Campbell Cloud.

GEOJSON Format Structure

{
    "type": "Feature",
    "geometry": {
        "type": "Point",
        "coordinates": [
            <Longitude>,
            <Latitude>,
            <Altitude>
        ]
    },
    "Properties": {
        "loggerID": <MQT ClientID>,
        "publish_ts": <Time Stamp of Publish ISO 8601 Formatted>
        "observationNames": [
            <field name>
        ],
        "observations": {
            "timeStamp": [
                Value 1
            ]
        }
    }
}

Invalid Data

Floating-point NaN or INF values are encoded as the string null. Invalid integer values are encoded as null.

Example

{
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [
     -111.8549,
      41.7666,
      4498.0
    ]
  },
  "properties": {
    "loggerID": "CR1000X_1001",
    "publish_ts": "2025-10-01T09:21:00.038Z",
    "observationNames": [
      "logger_temp",
      "extreme_temperature",
      "message"
    ],
    "observations": {
      "2025-10-01T09:21:00Z": [
        75,
        false,
        "75.25 : It is warm"
      ]
    }
  }
}

CSIJSON Output Format

The CSI-JSON data format contains detailed information about the data logger, and each data field.

CSIJSON Format Structure

{
  "head": {
    "transaction": 0,
    "signature": <CRBasic Program Signature>,
    "environment": {
      "station_name": <Data Logger Station Name>,
      "table_name": <Data Table Name>,
      "model": <Data Logger Model>,
      "serial_no": <Data Logger Serial Number>,
      "os_version": <Operating System Version>,
      "prog_name": <CRBasic Program Name>
    },
    "fields": [
      {
        "name": <Field Name>,
        "type": <Data Type>,
        "process": <Data Table Processing Type>,
        "settable": <True/False>
      }
    ]
  },
  "data": [
    {
      "time": <Time Stamp ISO 8601 Formatted>,
      "vals": [
        value 1
      ]
    }
  ]
}

Invalid Data

Floating-point NaN or INF values are encoded as the string "NAN", "+INF", "-INF". Invalid integer values are encoded as "NAN".

Example

{
  "head": {
    "transaction": 0,
    "signature": 41303,
    "environment": {
      "station_name": "Diddly Squat",
      "table_name": "Logger_Chart",
      "model": "CR1000X",
      "serial_no": "70021",
      "os_version": "CR1000X.8.4.0",
      "prog_name": "CPU:DidleyData.CRB"
    },
    "fields": [
      {
        "name": "battery_level",
        "type": "xsd:float",
        "process": "Smp",
        "settable": false
      },
      {
        "name": "logger_temp",
        "type": "xsd:float",
        "process": "Smp",
        "settable": false
      }
    ]
  },
  "data": [
    {
      "time": "2025-10-01T09:18:30",
      "vals": [
        13.59613,
        75.23302
      ]
    }
  ]
}

BASICJSON

The Basic JSON format is a lighter-weight payload. Each key represents a variable name, such as PanelTemp, or BattVolt. The value paired with the key provides the corresponding data.

GEOJSON Format Structure

{
  "table": <Table Name>,
  "data": [
    {
      "time": <Time Stamp ISO 8601 Formatted>,
      "no": <Record Number>,
      "Variable 1 Name": Value,
      "Variable 2 Name": Value,
      "Variable 3 Name": Value
      ]
    }
  ]
}

Invalid Data

Floating-point NaN or INF values are encoded as the string "NAN". Invalid integer values are encoded as -2147483648.

Example

{
  "table": "Lamborghini_1R_Chart",
  "data": [
    {
      "time": "2025-10-01T10:12:00",
      "no": 101,
      "engine_rpm": 1700,
      "fuel_level": 94.97893,
      "pto_engaged": true,
      "location": "North 40",
      "tire_pressure": [
        32.1,
        32.2,
        33.1,
        33.2
      ]
    }
  ]
}