3 ms·
What stops you from parsing tokens from a stream like a SAX parser for JSON? [ ["aaa", "bbb"], { "name", "foo" } ] Start array Start array String
by hombre_fatal 1y ago
What stops you from parsing tokens from a stream like a SAX parser for JSON?
[ ["aaa", "bbb"], { "name", "foo" } ]
Start array
Start array
String aaa
String bbb
End array
Start object
Key name
String foo
End object
End array
- ChrisMarshallNY 1y agoNothing, really, but I don’t have the bandwidth to write JSAX. I wonder why it hasn’t already been done by someone more qualified than I am. I suspect that I’d find out, if I started doing it. You can do that, in a specialized manner, with PHP, and Streaming JSON Parser[0]. I use that, in one of my server projects[1]. It claims to be JSON SAX, but I haven’t really done an objective comparison, and it specializes for file types. It works for my purposes. [0] https://github.com/salsify/jsonstreamingparser https://github.com/salsify/jsonstreamingparser [1] https://github.com/LittleGreenViper/LGV_TZ_Lookup/blob/main/src/Sources/LGV_TZ_Lookup_Loader.class.php https://github.com/LittleGreenViper/LGV_TZ_Lookup/blob/main/...
- hombre_fatal 1y agoStreaming JSON parsers certainly exist. I'm just pointing out there's nothing about JSON that makes it inherently harder to stream than an XML tree. In response to "Json is just a packing format that does have that [streaming] limitation".