"Because the format is JSON, you're not going to have a valid object tree until the last byte loads. You have to wait for the entire thing to load, then call JSON.parse, and then process it.
I have a filter I wrote that just reformats JSON into line-delimited text that can be processed immediately by line-oriented UNIX utilities. No waiting.
"The client can't do anything with JSON until the server sends the last byte."
"Would you call [JSON] good engineering?"
I would not call it "engineering". I would call it design.
IMO, djb's netstrings^1 is better design. It inspired similar designs such as bencode.^2
I have a filter I wrote that just reformats JSON into line-delimited text that can be processed immediately by line-oriented UNIX utilities. No waiting.
"The client can't do anything with JSON until the server sends the last byte."
"Would you call [JSON] good engineering?"
I would not call it "engineering". I would call it design.
IMO, djb's netstrings^1 is better design. It inspired similar designs such as bencode.^2
1. https://cr.yp.to/proto/netstrings.txt (1997)
2. https://wiki.theory.org/BitTorrentSpecification (2001)
"And yet [JSON's] the status quo-that's how 99.9999%^* of apps send and process JSON."
Perhaps "good" does not necessarily correlate with status quo and popularity.
Also, it is worth considering that JSON was created for certain popular www browsers. It could piggyback on the popularity of that software.