File tree Expand file tree Collapse file tree 3 files changed +2
-25
lines changed
Expand file tree Collapse file tree 3 files changed +2
-25
lines changed Original file line number Diff line number Diff line change @@ -158,13 +158,6 @@ class JSON_API FastWriter : public Writer {
158158
159159 void enableYAMLCompatibility ();
160160
161- /* * \brief Drop the "null" string from the writer's output for nullValues.
162- * Strictly speaking, this is not valid JSON. But when the output is being
163- * fed to a browser's Javascript, it makes for smaller output and the
164- * browser can handle the output just fine.
165- */
166- void dropNullPlaceholders ();
167-
168161public: // overridden from Writer
169162 virtual std::string write (const Value& root);
170163
@@ -173,7 +166,6 @@ class JSON_API FastWriter : public Writer {
173166
174167 std::string document_;
175168 bool yamlCompatiblityEnabled_;
176- bool dropNullPlaceholders_;
177169};
178170
179171/* * \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a
Original file line number Diff line number Diff line change @@ -284,12 +284,10 @@ Writer::~Writer() {}
284284// //////////////////////////////////////////////////////////////////
285285
286286FastWriter::FastWriter ()
287- : yamlCompatiblityEnabled_(false ), dropNullPlaceholders_( false ) {}
287+ : yamlCompatiblityEnabled_(false ) {}
288288
289289void FastWriter::enableYAMLCompatibility () { yamlCompatiblityEnabled_ = true ; }
290290
291- void FastWriter::dropNullPlaceholders () { dropNullPlaceholders_ = true ; }
292-
293291std::string FastWriter::write (const Value& root) {
294292 document_ = " " ;
295293 writeValue (root);
@@ -300,8 +298,7 @@ std::string FastWriter::write(const Value& root) {
300298void FastWriter::writeValue (const Value& value) {
301299 switch (value.type ()) {
302300 case nullValue:
303- if (!dropNullPlaceholders_)
304- document_ += " null" ;
301+ document_ += " null" ;
305302 break ;
306303 case intValue:
307304 document_ += valueToString (value.asLargestInt ());
Original file line number Diff line number Diff line change @@ -1618,17 +1618,6 @@ JSONTEST_FIXTURE(ValueTest, zeroesInKeys) {
16181618 }
16191619}
16201620
1621- struct WriterTest : JsonTest::TestCase {};
1622-
1623- JSONTEST_FIXTURE (WriterTest, dropNullPlaceholders) {
1624- Json::FastWriter writer;
1625- Json::Value nullValue;
1626- JSONTEST_ASSERT (writer.write (nullValue) == " null\n " );
1627-
1628- writer.dropNullPlaceholders ();
1629- JSONTEST_ASSERT (writer.write (nullValue) == " \n " );
1630- }
1631-
16321621struct StreamWriterTest : JsonTest::TestCase {};
16331622
16341623JSONTEST_FIXTURE (StreamWriterTest, dropNullPlaceholders) {
@@ -2286,7 +2275,6 @@ int main(int argc, const char* argv[]) {
22862275 JSONTEST_REGISTER_FIXTURE (runner, ValueTest, zeroes);
22872276 JSONTEST_REGISTER_FIXTURE (runner, ValueTest, zeroesInKeys);
22882277
2289- JSONTEST_REGISTER_FIXTURE (runner, WriterTest, dropNullPlaceholders);
22902278 JSONTEST_REGISTER_FIXTURE (runner, StreamWriterTest, dropNullPlaceholders);
22912279 JSONTEST_REGISTER_FIXTURE (runner, StreamWriterTest, writeZeroes);
22922280
You can’t perform that action at this time.
0 commit comments