5 ms·
If you have a file or network stream with millions of separate JSON items, then you might want to parse and process each item separately as it is received, and
by PeterisP 7y ago
If you have a file or network stream with millions of separate JSON items, then you might want to parse and process each item separately as it is received, and the surrounding structure just gets in the way. That being said, it's properly better to explicitly acknowledge that you're using something-like-json-but-not-really-json like http://jsonlines.org http://jsonlines.org does instead of simply concatenating json objects.
- will4274 7y agoWith the application understanding that the top level object is an array of independently parsable json objects, it should still be possible to stream the format I suggested, assuming you use a streaming / sax parser.
- im3w1l 7y agoStreaming parsers are very inconvenient to work with.
- rurban 7y agoThe delimiters don't get in the way, they protect you from MITM and other attacks. It's a security feature, not a bug.