2 ms·
> 2. Plain JSON supports exactly 1 record per stream or file. Unless you wrap it in an array, which is all this is doing.
by BugsJustFindMe 5y ago
> 2. Plain JSON supports exactly 1 record per stream or file.
Unless you wrap it in an array, which is all this is doing.
- nerdponx 5y agoNo, that is not "all this is doing". A JSON array is exactly 1 "record", in that it must be parsed entirely before it can be interpreted as anything other than a string of text. Moreover, you can write a ND-JSON file where each record is an array. The following is valid ND-JSON: ["a", "b", "c"] ["u", "v"] ["x", "y", "z"]
- wolfgang42 5y ago> must be parsed entirely Streaming JSON parsers do exist, but they’re rather specialized and harder to use than JSON.parse(). The advantage of ND-JSON is that you can get the same effect in a much simpler way.