Skip to content

Commit 206e6a8

Browse files
authored
Update HAPI data access spec for JSON streaming (#271)
Addresses #269
1 parent 83c3e50 commit 206e6a8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

hapi-dev/HAPI-data-access-spec-dev.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1701,9 +1701,19 @@ For the JSON output, an additional `data` element added to the header contains t
17011701
}
17021702
```
17031703

1704+
#3610-units-and-label-array
1705+
17041706
The data element is a JSON array of records. Each record is itself an array of parameters. The time and string values are in quotes, and any data parameter in the record that is an array must be inside square brackets. This data element appears as the last JSON element in the header.
17051707

1706-
The record-oriented arrangement of the JSON format is designed to allow a streaming client reader to begin reading (and processing) the JSON data stream before it is complete. Note also that servers can stream the data when records are available. In other words, the JSON format can be read and written without holding all the records in memory. This may require a custom JSON formatter, but this streaming capability is important for large responses.
1708+
The record-oriented arrangement of the JSON format is designed to allow a streaming client reader to begin reading (and processing) the JSON data stream before it is complete. Note also that servers can stream the data when records are available. In other words, the JSON format can be read and written without requiring all the records to be held in memory. This may require a custom JSON formatter, but this streaming capability is important for large responses.
1709+
1710+
For multi-dimensional parameters, each element must be an array of arrays (similar to [units and labels](#3610-units-and-label-array) when each component of a parameter has a label). For example, a record for a scalar parameter and a `size=[2,3]` parameter would be
1711+
1712+
```
1713+
["2017-11-13T12:34:56.789Z", 99, [ [1, 2, 3] [4, 5, 6] ] ]
1714+
```
1715+
1716+
Note that the record resembles the CSV response in terms of the order of numbers, with the only difference being the addition of square brackets.
17071717

17081718
### 3.7.5 Errors While Streaming
17091719

0 commit comments

Comments
 (0)