Skip to content

Commit f4bdc1b

Browse files
committed
partially revert 'Added features that allow the reader to accept common non-standard JSON.'
revert '642befc836ac5093b528e7d8b4fd66b66735a98c', but keep the *added* methods for `decodedNumber()` and `decodedDouble()`.
1 parent 93f45d0 commit f4bdc1b

File tree

2 files changed

+3
-27
lines changed

2 files changed

+3
-27
lines changed

Diff for: include/json/features.h

-6
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,6 @@ class JSON_API Features {
4444
/// \c true if root must be either an array or an object value. Default: \c
4545
/// false.
4646
bool strictRoot_;
47-
48-
/// \c true if dropped null placeholders are allowed. Default: \c false.
49-
bool allowDroppedNullPlaceholders_;
50-
51-
/// \c true if numeric object key are allowed. Default: \c false.
52-
bool allowNumericKeys_;
5347
};
5448

5549
} // namespace Json

Diff for: src/lib_json/json_reader.cpp

+3-21
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,14 @@ typedef std::auto_ptr<CharReader> CharReaderPtr;
4242
// ////////////////////////////////
4343

4444
Features::Features()
45-
: allowComments_(true), strictRoot_(false),
46-
allowDroppedNullPlaceholders_(false), allowNumericKeys_(false) {}
47-
45+
: allowComments_(true), strictRoot_(false)
46+
{}
4847
Features Features::all() { return Features(); }
4948

5049
Features Features::strictMode() {
5150
Features features;
5251
features.allowComments_ = false;
5352
features.strictRoot_ = true;
54-
features.allowDroppedNullPlaceholders_ = false;
55-
features.allowNumericKeys_ = false;
5653
return features;
5754
}
5855

@@ -190,17 +187,7 @@ bool Reader::readValue() {
190187
currentValue().swapPayload(v);
191188
}
192189
break;
193-
case tokenArraySeparator:
194-
case tokenObjectEnd:
195-
case tokenArrayEnd:
196-
if (features_.allowDroppedNullPlaceholders_) {
197-
// "Un-read" the current token and mark the current value as a null
198-
// token.
199-
current_--;
200-
Value v;
201-
currentValue().swapPayload(v);
202-
break;
203-
} // Else, fall through...
190+
// Else, fall through...
204191
default:
205192
return addError("Syntax error: value, object or array expected.", token);
206193
}
@@ -446,11 +433,6 @@ bool Reader::readObject(Token& /*tokenStart*/) {
446433
if (tokenName.type_ == tokenString) {
447434
if (!decodeString(tokenName, name))
448435
return recoverFromError(tokenObjectEnd);
449-
} else if (tokenName.type_ == tokenNumber && features_.allowNumericKeys_) {
450-
Value numberName;
451-
if (!decodeNumber(tokenName, numberName))
452-
return recoverFromError(tokenObjectEnd);
453-
name = numberName.asString();
454436
} else {
455437
break;
456438
}

0 commit comments

Comments
 (0)