-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
incremental parsing with sax_parser #2030
Comments
The parser accepts an iterator range as input - as long as you can wrap your input in a type with a |
Why is it in a |
It is in the |
I was more concern about api stability (will it break ?) and why it's not documented. Re-Implementing a sax parser seems unnecessary if there is a perfectly good one for incremental parsing. |
You do not need to reimplement it - sorry for the confusion. You only need to define an input adapter. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@nlohmann : First of all, I'd like to thank you for your fantastic work on this library. I'm reopening this discussion because I'm unsure about the behavior of sax_parse when it is called incrementally. Based on my tests, it seems to work only if each chunk provided to sax_parse is a well-formed JSON object. I'm wondering if this is the expected behavior, or if I might be missing something. In a streaming context, it's not always possible to control the content of each chunk. Here’s an example to illustrate my point:
Not working example :
Displayed errors :
Just as a comparison, when using the SAX API of libxml2, there is Is there any way to achieve similar functionality with the nlohmann/json library? Thank you in advance! |
No, this is not possible. Each call to |
I'm reading (possibly big) json data from the network. I'm using boost:asio for that. I would have expected something of the like:
An asio
read()
returns a Sequence of buffer(an container of char*). So I need to calljson::sax_parse
multiple times.I have not found a default sax_parser implementation. One that just build a json incrementatlly with consecutive calls to
sax_parse()
Do I have to write my own for such (I believe) a simple task ?
Actually, I exactly want to do this #605 (comment)
The text was updated successfully, but these errors were encountered: