k6-docs icon indicating copy to clipboard operation
k6-docs copied to clipboard

Document that JSON format is actually JSON lines format

Open MattDodsonEnglish opened this issue 1 year ago • 0 comments

The JSON is output is not really JSON, but JSON lines. Proper JSON would be enclosed in square brackets with each item in the array separated by commas. The JSON lines format just puts all objects on its own line.

The implication is that a little pre-processing needs to be done to be usable by something like node's readFile. Jq could do it with jq -s '.' ./result.json > result-array.json.

As I understand, JSON lines makes it possible to stream the output, so the output has advantages. But, the correct format should be documented in the JSON output page.

Related k6 issue: https://github.com/grafana/k6/issues/737

MattDodsonEnglish avatar May 29 '23 23:05 MattDodsonEnglish