diff --git a/include/boost/json/detail/parse_into.hpp b/include/boost/json/detail/parse_into.hpp index 231d917e9..48c0a593b 100644 --- a/include/boost/json/detail/parse_into.hpp +++ b/include/boost/json/detail/parse_into.hpp @@ -1052,7 +1052,7 @@ struct ignoring_handler --array_depth_; if( (array_depth_ + object_depth_) == 0 ) - return parent_->signal_end(ec); + return parent_->signal_value(ec); return true; } diff --git a/test/parse_into.cpp b/test/parse_into.cpp index 404c9d9e4..241591fea 100644 --- a/test/parse_into.cpp +++ b/test/parse_into.cpp @@ -73,6 +73,18 @@ struct Z : X BOOST_DESCRIBE_CLASS(Z, (X), (), (), (d)) }; +struct W +{ + X x; +}; + +BOOST_DESCRIBE_STRUCT(W, (), (x)) + +bool operator==( W const& w1, W const& w2 ) +{ + return w1.x == w2.x; +} + BOOST_DEFINE_ENUM_CLASS(E, x, y, z) namespace boost { @@ -401,6 +413,19 @@ class parse_into_test jo["e7"] = false; jo["e8"] = nullptr; testParseIntoValue(jo); + + object const unexpected_jo{{"x", object{{"unexpectedArray", array{}}, + {"unexpectedObject", object{}}, + {"unexpectedString", "qwerty"}, + {"unexpectedInt", 42}, + {"unexpectedUint", ULONG_MAX}, + {"unexpectedDouble", 2.71}, + {"unexpectedBool", true}, + {"unexpectedNull", nullptr}, + {"a", 1}, + {"b", 3.14f}, + {"c", "hello"}}}}; + testParseIntoValue(unexpected_jo); #endif }