You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Plain JSON is not entirely streamable... it requires its fields to be closed properly (by ] and }) at the end.
e.g.,
"events": [
{ "key": "val" }
Will fail, but
"events": [
{ "key": "val" }
]
will succeed.
However, one could employ a streaming JSON parser (e.g., http://oboejs.com/) and ignore unclosed fields at the end that way.
For the way the format is currently defined, an implementation would then write the "header" of the qlog file, and then it could stream individual events that are just appended to the file.
If the file isn't properly closed, that's not a problem: the streaming parser user just ignores those errors.
However, this breaks compatibility with the built-in parsers in many stdlibs and the browsers themselves.
It would also be possible to write a simple postprocessing tool that simply appends the necessary "closing" characters to a qlog file if it isn't complete, though that adds another step in a pipeline...
There are also various JSON-subformats that address this problem (see https://en.wikipedia.org/wiki/JSON_streaming), but they also do not seem to be supported in the standard JSON parsers for many platforms...
Given all this, my personal preference is to stay with just the normal JSON format and tools are recommended to use a streaming parser.
Example of how the browser's built-in JSON parser does not support special JSON:
Example of how a streaming parser (oboe) does handle this properly:
The text was updated successfully, but these errors were encountered:
- Removes the event_fields optimization. Relates to #30. Fixes#89.
- Removes several points of complexity wrt the group_id field, as they were not being used in practice.
- Makes JSON the default serialization option. Fixes#101.
- Adds a proper streaming option with NDJSON. Relates to #106. Fixes#109, #2.
- Generally tightens the text and adds more examples.
Plain JSON is not entirely streamable... it requires its fields to be closed properly (by ] and }) at the end.
e.g.,
Will fail, but
will succeed.
However, one could employ a streaming JSON parser (e.g., http://oboejs.com/) and ignore unclosed fields at the end that way.
For the way the format is currently defined, an implementation would then write the "header" of the qlog file, and then it could stream individual events that are just appended to the file.
If the file isn't properly closed, that's not a problem: the streaming parser user just ignores those errors.
However, this breaks compatibility with the built-in parsers in many stdlibs and the browsers themselves.
It would also be possible to write a simple postprocessing tool that simply appends the necessary "closing" characters to a qlog file if it isn't complete, though that adds another step in a pipeline...
There are also various JSON-subformats that address this problem (see https://en.wikipedia.org/wiki/JSON_streaming), but they also do not seem to be supported in the standard JSON parsers for many platforms...
Given all this, my personal preference is to stay with just the normal JSON format and tools are recommended to use a streaming parser.
Example of how the browser's built-in JSON parser does not support special JSON:
Example of how a streaming parser (oboe) does handle this properly:
The text was updated successfully, but these errors were encountered: