diff --git a/src/lib_json/json_reader.cpp b/src/lib_json/json_reader.cpp index 5b6299906..bb7f25ffe 100644 --- a/src/lib_json/json_reader.cpp +++ b/src/lib_json/json_reader.cpp @@ -852,6 +852,7 @@ class OurFeatures { bool rejectDupKeys_; bool allowSpecialFloats_; bool skipBom_; + bool skipEscapeString_; size_t stackLimit_; }; // OurFeatures @@ -1427,8 +1428,10 @@ bool OurReader::readObject(Token& token) { return true; name.clear(); if (tokenName.type_ == tokenString) { - if (!decodeString(tokenName, name)) + name = String(tokenName.start_ + 1, tokenName.end_ - 1); + /*if (!decodeString(tokenName, name)) return recoverFromError(tokenObjectEnd); + */ } else if (tokenName.type_ == tokenNumber && features_.allowNumericKeys_) { Value numberName; if (!decodeNumber(tokenName, numberName)) @@ -1639,6 +1642,10 @@ bool OurReader::decodeString(Token& token, String& decoded) { decoded.reserve(static_cast(token.end_ - token.start_ - 2)); Location current = token.start_ + 1; // skip '"' Location end = token.end_ - 1; // do not include '"' + if (features_.skipEscapeString_) { + decoded = String(current, end); + return true; + } while (current != end) { Char c = *current++; if (c == '"') @@ -1884,6 +1891,7 @@ CharReader* CharReaderBuilder::newCharReader() const { features.rejectDupKeys_ = settings_["rejectDupKeys"].asBool(); features.allowSpecialFloats_ = settings_["allowSpecialFloats"].asBool(); features.skipBom_ = settings_["skipBom"].asBool(); + features.skipEscapeString_ = settings_["skipEscapeString"].asBool(); return new OurCharReader(collectComments, features); }