Not all languages / frameworks / libraries have an easy time dealing with NDJSON out of the box, even if they have streaming capabilities.
It might be interesting to explore and alternate format: streaming as a normal JSON array.
How? First we send the [ character, then we send each row as an independent JSON object (well, an array? could be configurable to set the column names properly), send a comma in between, send a ] at the end.
This way we don't have to hold onto all the rows in-memory but can still stream a normal JSON array.
Not all languages / frameworks / libraries have an easy time dealing with NDJSON out of the box, even if they have streaming capabilities.
It might be interesting to explore and alternate format: streaming as a normal JSON array.
How? First we send the
[character, then we send each row as an independent JSON object (well, an array? could be configurable to set the column names properly), send a comma in between, send a]at the end.This way we don't have to hold onto all the rows in-memory but can still stream a normal JSON array.