Skip to content
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

Fix example to not report syntax error on valid JSON input #98

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rmisev
Copy link

@rmisev rmisev commented Apr 4, 2017

Adds parse_array_stop(size_t) override, which returns true, to
the root_context class in the streaming.cc example.

If not overriden, picojson::deny_parse_context::parse_array_stop(size_t)
returns false what causes syntax error.

Related issue: #82

@ooer
Copy link

ooer commented Jul 6, 2017

It would be great to pull at least commit f5fdb1f
It took me some time to fix the same problem.

Thank you.

Adds parse_array_stop(size_t) override which returns true to
the root_context class in the streaming.cc example.

If not overriden, picojson::deny_parse_context::parse_array_stop(size_t)
returns false what causes syntax error.

Related issue: kazuho#82
Used in the example std::istream_iterator skips whitespace and thus
a parser can produce unexpected reult, e.g.:

 Input: [{"x":"test space","y":20}]
 Output: "testspace",20

std::istreambuf_iterator does not skip whitespace, so is more
appropriate:

 Output: "test space",20

More info:
http://en.cppreference.com/w/cpp/iterator/istream_iterator (see "Notes"
section).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants