From f5fdb1f6013ce9403594e26428426e0090d25f59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rimas=20Misevi=C4=8Dius?= Date: Tue, 4 Apr 2017 22:03:23 +0300 Subject: [PATCH] Fix example to not report syntax error on valid JSON input 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: https://github.com/kazuho/picojson/issues/82 --- examples/streaming.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/streaming.cc b/examples/streaming.cc index bca0209..1baf75a 100644 --- a/examples/streaming.cc +++ b/examples/streaming.cc @@ -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 bool parse_array_item(picojson::input &in, size_t) { picojson::value item; // parse the array item