Skip to content

Commit

Permalink
Fix example to not report syntax error on valid JSON input
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rmisev committed Apr 4, 2017
1 parent 1ebfc7b commit f5fdb1f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/streaming.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class root_context : public picojson::deny_parse_context {
bool parse_array_start() {
return true; // only allow array as root
}
bool parse_array_stop(size_t) {
return true;
}
template <typename Iter> bool parse_array_item(picojson::input<Iter> &in, size_t) {
picojson::value item;
// parse the array item
Expand Down

0 comments on commit f5fdb1f

Please sign in to comment.