Skip to content

Allow json to decode streamed data / async json parser #89

Open
@darronschall

Description

@darronschall

Originally filed by marko.kocic on 2009-02-12T16:03:24

It would be a great addition to json library if it could be used to decode
String stream. It is usefull when you are reading a sockes and parsing its
content on the fly.

I slightly modified JSONDecoder and JSONTokenizer (made some vars public)
and addet new classes JSonFlow and JSonDataEvent. JSonFlow can take partial
json strings in its feedIt method. Then it parses the string and generates
events whenever it parses some object.

It basically works, but I still didn't figure out the best way to handle
errors. Currently, if ParseError is catched, it just aborts and waits for
new feed of data, assuming it failed because of incomplete input. Real
error handling would probably raquire more changer to Tokenizer.

Are you interesting in cleaning this up and adding to the one of the
following releases?

Regards,
Marko Kocić

Attached 2 files.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions