# JSON Payloads

YuDash [LYNX](https://docs.yudash.com/yudash-iot-devices/lynx-user-manual) and other IoT Devices support the following JSON payload formats of payload. Each format has a unique number (starting with 10). &#x20;

We explain each JSON format with an example of energy monitoring:

* There are three process variables/tags.  Voltage, frequency and energy, namely:  **volt1\_in**  **freq\_in**  and **kwhr\_in**
* Numerical  values (floating points) are read by LYNX for reach variable.
* There is a string variable **status\_var1** which is used to capture device status information. This is an optional variable in which LYNX sends in device information at bootup and periodically.
* The variable names for device information are treated just like process variables.
* The timestamp variables are processed as per the given JSON format. It is a purely optional parameter and should only be used when back-fill feature is required.
* LYNX has two user provided input strings (Payload Gen Key#1 and Payload Gen Key#2).  We will call them **`plKey1`** and **`plKey2`**.

## JSON PAYLOADS

### JSON\_FORMAT\_10

* This is the simplest JSON format with key value pairs.
* plKey1 and plKey2 are not used.

**Sample payload format**

```
{
  "volt1_in": 237.67,
  "freq_in": 49.98,
  "kwhr_in": 1792.17
}
```

**Status Variable Payload**

```
{
  "status_var1":"LYNX rebooted. count=7700. reason=0"
}
```

### JSON\_FORMAT\_11

* This is a two level JSON format with variable names as main key.
* **plKey1**  is not used. **plKey2** is used. This is set as "**value**" in the example below.

**Data payload format**

```
// JSON_FORMAT_11
{

  "volt1_in": {
    "value": 244.4
  },
  "freq_in": {
    "value": 50
  },
  "kwhr_in": {
    "value": 1792.17
  }
}
```

### JSON\_FORMAT\_12

* This is a JSON array with data points for each variables.
* **plKey1**  is used (set to field in example). **plKey2** is used and set as value in the example below.

**Data payload format**

```
[
  {
    "field": "volt1_in",
    "value": 242.34
  },
  {
    "field": "freq_in",
    "value": 49.92
  },
  {
    "field": "kwhr_in",
    "value": 1792.17
  }
]
```

**Status Variable Payload**

```
[
  {
    "field": "status_var1",
    "value": "status: RSS: -60 db, wifi_name: ***, wifi_ip:***"
  }
]
```

### JSON\_FORMAT\_13

* This is a two level JSON structure.
* **plKey1** is used (set to data in example). **plKey2** is not used.

**Data Payload**

```
{
  "data": {
    "volt1_in": 241.65,
    "freq_in": 49.99,
    "kwhr_in": 1792.17
  }
}
```

**Status Variable Payload**

```
{
  "data": {
    "status_var1": "status: RSS: -62 db, wifi_name: ***, wifi_ip:###"
  }
}
```

### JSON\_FORMAT\_14 and JSON\_FORMAT\_15

* These are proprietary JSON formats for Indian State Pollution control Board.

### JSON\_FORMAT\_16

* Proprietary JSON payload for Indian OEM customer.

### JSON\_FORMAT\_17 and JSON\_FORMAT\_18

* Generic two level JSON payloads with option of array (FORMAT\_17) and json (FORMAT\_18).

## TimeStamp Formats <a href="#h.t8n8abq6601b_l" id="h.t8n8abq6601b_l"></a>

LYNX supports the following timestamp formats to send to cloud server when timestamp has been enabled.&#x20;

The time displayed on YuDash LYNX is local time (based on time-zone provided). In most cases, it is advised to store/send UTC time stamps.&#x20;

### UTC Time Stamp Formats

| Time Stamp Format                     | Sample Time Stamp                           |
| ------------------------------------- | ------------------------------------------- |
| TS\_50 (UTC Seconds)                  | 1675630526                                  |
| TS\_51 (UTC MilliSeconds)             | 1675630526000                               |
| TS\_52 (UTC YYYY-MM-DDTHH:MM:SS)      | 2023-02-05T20:55:26Z                        |
| TS\_53 (UTC YYYY-MM-DD HH:MM:SS)      | 2023-02-05 20:55:26                         |
| TS\_54 (UTC YYYY\_MM\_DD\_HH\_MM\_SS) | 2023\_02\_05\_20\_55\_26                    |
| TS\_55 (UTC YYYY-MM-DDTHH:MM:00)      | 2023-02-05 20:55:00 *(seconds taken as 00)* |
| TS\_56 (UTC DD-MM-YYYY HH:MM:SS)      | 05-02-2023 20:55:26                         |

### Local Time Stamp Formats

<table><thead><tr><th width="527">Time Stamp Format</th><th>Sample Time Stamp</th></tr></thead><tbody><tr><td>TS_60 (LocalTime Seconds)</td><td></td></tr><tr><td>TS_61 (LocalTime MilliSeconds)</td><td></td></tr><tr><td>TS_62 (LocalTime YYYY-MM-DDTHH:MM:SS)</td><td></td></tr><tr><td>TS_63 (LocalTime YYYY-MM-DD HH:MM:SS)</td><td></td></tr><tr><td>TS_64 (LocalTime YYYY_MM_DD_HH_MM_SS)</td><td></td></tr><tr><td>TS_65 (LocalTime YYYY-MM-DDTHH:MM:00)</td><td></td></tr><tr><td>TS_66 (LocalTime DD-MM-YYYY HH:MM:SS)</td><td></td></tr></tbody></table>

The time stamps are sent along with Time Stamp Key (**tsKey**). They are grouped in within json format depending on JSON\_FORMAT\_. The timestamp key is set as timestamp in all  the examples. Typically, based on server requirement timestamp, ts or time keywords are used.

JSON\_FORMAT\_10, TS\_50

```
{
  "volt1_in": 247.55,
  "freq_in": 49.94,
  "kwhr_in": 1792.17,
  "timestamp": "1675630887"
}
```
