diff --git a/src/idl_parser.cpp b/src/idl_parser.cpp index adbd79edc..263f6509a 100644 --- a/src/idl_parser.cpp +++ b/src/idl_parser.cpp @@ -1557,8 +1557,12 @@ CheckedError Parser::SkipJsonObject() { for (;;) { if ((!opts.strict_json || !fieldn) && Is('}')) break; - if (!Is(kTokenStringConstant)) + if (!Is(kTokenStringConstant)) { EXPECT(opts.strict_json ? kTokenStringConstant : kTokenIdentifier); + } + else { + NEXT(); + } EXPECT(':'); ECHECK(SkipAnyJsonValue()); diff --git a/tests/test.cpp b/tests/test.cpp index fce249e99..42d9e3ce1 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -830,10 +830,13 @@ void UnknownFieldsTest() { TEST_EQ(parser.Parse("table T { str:string; i:int;}" "root_type T;" "{ str:\"test\"," + "unknown_string:\"test\"," + "\"unknown_string\":\"test\"," "unknown_int:10," "unknown_float:1.0," "unknown_array: [ 1, 2, 3, 4]," "unknown_object: { i: 10 }," + "\"unknown_object\": { \"i\": 10 }," "i:10}"), true); std::string jsongen;