add rejectDupKeys feature - not yet impld
diff --git a/include/json/reader.h b/include/json/reader.h
index f983ce9..251d7c6 100644
--- a/include/json/reader.h
+++ b/include/json/reader.h
@@ -320,6 +320,8 @@
- `"failIfExtra": false or true`
- If true, `parse()` returns false when extra non-whitespace trails
the JSON value in the input string.
+ - `"rejectDupKeys": false or true`
+ - If true, `parse()` returns false when a key is duplicated within an object.
You can examine 'settings_` yourself
to see the defaults. You can also write and read them just like any
diff --git a/src/lib_json/json_reader.cpp b/src/lib_json/json_reader.cpp
index b04b60a..c79abdf 100644
--- a/src/lib_json/json_reader.cpp
+++ b/src/lib_json/json_reader.cpp
@@ -916,6 +916,7 @@
bool allowNumericKeys_;
bool allowSingleQuotes_;
bool failIfExtra_;
+ bool rejectDupKeys_;
int stackLimit_;
}; // OurFeatures
@@ -1896,6 +1897,7 @@
features.allowSingleQuotes_ = settings_["allowSingleQuotes"].asBool();
features.stackLimit_ = settings_["stackLimit"].asInt();
features.failIfExtra_ = settings_["failIfExtra"].asBool();
+ features.rejectDupKeys_ = settings_["rejectDupKeys"].asBool();
return new OurCharReader(collectComments, features);
}
static void getValidReaderKeys(std::set<std::string>* valid_keys)
@@ -1909,6 +1911,7 @@
valid_keys->insert("allowSingleQuotes");
valid_keys->insert("stackLimit");
valid_keys->insert("failIfExtra");
+ valid_keys->insert("rejectDupKeys");
}
bool CharReaderBuilder::validate(Json::Value* invalid) const
{
@@ -1941,6 +1944,7 @@
(*settings)["allowNumericKeys"] = false;
(*settings)["allowSingleQuotes"] = false;
(*settings)["failIfExtra"] = true;
+ (*settings)["rejectDupKeys"] = true;
//! [CharReaderBuilderStrictMode]
}
// static
@@ -1955,6 +1959,7 @@
(*settings)["allowSingleQuotes"] = false;
(*settings)["stackLimit"] = 1000;
(*settings)["failIfExtra"] = false;
+ (*settings)["rejectDupKeys"] = false;
//! [CharReaderBuilderDefaults]
}