# Output formats

> The output_format parameter chooses how time series and spectra are laid out in the JSON response.

High-rate readings come back as series: a list of values, each with a time (or, for spectra, a frequency). The `output_format` parameter sets the layout of every series in a response. Single values, such as `theta` in the `data` table, are not affected.

## The five formats

| Format | Layout of one series | Example |
| --- | --- | --- |
| `map` (default) | Object keyed by time or frequency | `{"1764547200000.0": 0.012}` |
| `tuple_array` | List of `[time, value]` pairs | `[[1764547200000, 0.012]]` |
| `dict_array` | List of objects | `[{"time": 1764547200000, "val": 0.012}]` |
| `combined_tuple` | Axes grouped in one list | `[[1764547200000, 0.012, -0.003, 0.998]]` |
| `combined_dict` | Axes grouped in one list of objects | `[{"time": 1764547200000, "x": 0.012, "y": -0.003, "z": 0.998}]` |

### map

Each series is an object. The keys are strings, and the values are numbers. Time keys are milliseconds written as decimals, such as `"1764547200019.53125"`, because a sample can fall between two whole milliseconds. Frequency keys are hertz with at least three digits before the point, such as `"002.5"`. Parse keys as numbers; don't compare them as strings.

### tuple_array and dict_array

Each series is a list, in time order. `tuple_array` gives `[time, value]` pairs. `dict_array` gives objects with `time` and `val`, or `freq` and `val` for spectra.

### combined_tuple and combined_dict

These formats put the axes of one sensor side by side, so each row holds one moment for all axes:

| Group | Replaces | Row in `combined_tuple` | Keys in `combined_dict` |
| --- | --- | --- | --- |
| `acc` | `acc_x`, `acc_y`, `acc_z` | `[time, x, y, z]` | `time`, `x`, `y`, `z` |
| `gyr` | `gyr_x`, `gyr_y`, `gyr_z` | `[time, x, y, z]` | `time`, `x`, `y`, `z` |
| `ain` | `ain_a`, `ain_b` | `[time, a, b]` | `time`, `a`, `b` |
| `fft` | `fft_x`, `fft_y`, `fft_z` | `[freq, x, y, z]` | `freq`, `x`, `y`, `z` |

A group is only formed when all of its series are in the item. Other series in the same item, such as `tamb` in `acc`, use `tuple_array` under `combined_tuple` and `dict_array` under `combined_dict`.

## Which fields are series

| Table | Series fields |
| --- | --- |
| `acc` | `acc_x`, `acc_y`, `acc_z`, `tamb`, `w_s`, `w_d` |
| `gyr` | `gyr_x`, `gyr_y`, `gyr_z` |
| `ain` | `ain_a`, `ain_b` |
| `fft` | `fft` (with `merge=false`), or `fft_x`, `fft_y`, `fft_z` |
| `data` | `w_s_avg` |
| `env`, `connected` | none |

The `w_s_avg` field is a short series of six wind-speed averages. In `map` format its keys are `w_s_avg_0` to `w_s_avg_5` instead of times; in the other formats each point has the time it belongs to. See [data: summaries and tilt](https://asense.semitronica.pt/docs/data-model/data/).

Source page: https://asense.semitronica.pt/docs/api/output-formats/
