@@ -916,6 +916,7 @@ class OurFeatures {
916916 bool allowNumericKeys_;
917917 bool allowSingleQuotes_;
918918 bool failIfExtra_;
919+ bool rejectDupKeys_;
919920 int stackLimit_;
920921}; // OurFeatures
921922
@@ -1896,6 +1897,7 @@ CharReader* CharReaderBuilder::newCharReader() const
18961897 features.allowSingleQuotes_ = settings_[" allowSingleQuotes" ].asBool ();
18971898 features.stackLimit_ = settings_[" stackLimit" ].asInt ();
18981899 features.failIfExtra_ = settings_[" failIfExtra" ].asBool ();
1900+ features.rejectDupKeys_ = settings_[" rejectDupKeys" ].asBool ();
18991901 return new OurCharReader (collectComments, features);
19001902}
19011903static void getValidReaderKeys (std::set<std::string>* valid_keys)
@@ -1909,6 +1911,7 @@ static void getValidReaderKeys(std::set<std::string>* valid_keys)
19091911 valid_keys->insert (" allowSingleQuotes" );
19101912 valid_keys->insert (" stackLimit" );
19111913 valid_keys->insert (" failIfExtra" );
1914+ valid_keys->insert (" rejectDupKeys" );
19121915}
19131916bool CharReaderBuilder::validate (Json::Value* invalid) const
19141917{
@@ -1941,6 +1944,7 @@ void CharReaderBuilder::strictMode(Json::Value* settings)
19411944 (*settings)[" allowNumericKeys" ] = false ;
19421945 (*settings)[" allowSingleQuotes" ] = false ;
19431946 (*settings)[" failIfExtra" ] = true ;
1947+ (*settings)[" rejectDupKeys" ] = true ;
19441948// ! [CharReaderBuilderStrictMode]
19451949}
19461950// static
@@ -1955,6 +1959,7 @@ void CharReaderBuilder::setDefaults(Json::Value* settings)
19551959 (*settings)[" allowSingleQuotes" ] = false ;
19561960 (*settings)[" stackLimit" ] = 1000 ;
19571961 (*settings)[" failIfExtra" ] = false ;
1962+ (*settings)[" rejectDupKeys" ] = false ;
19581963// ! [CharReaderBuilderDefaults]
19591964}
19601965
0 commit comments