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 @@ -157,13 +157,6 @@ class JSON_API FastWriter : public Writer {
157157
158158 void enableYAMLCompatibility ();
159159
160- /* * \brief Drop the "null" string from the writer's output for nullValues.
161- * Strictly speaking, this is not valid JSON. But when the output is being
162- * fed to a browser's Javascript, it makes for smaller output and the
163- * browser can handle the output just fine.
164- */
165- void dropNullPlaceholders ();
166-
167160public: // overridden from Writer
168161 virtual std::string write (const Value& root);
169162
@@ -172,7 +165,6 @@ class JSON_API FastWriter : public Writer {
172165
173166 std::string document_;
174167 bool yamlCompatiblityEnabled_;
175- bool dropNullPlaceholders_;
176168};
177169
178170/* * \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 @@ -280,12 +280,10 @@ Writer::~Writer() {}
280280// //////////////////////////////////////////////////////////////////
281281
282282FastWriter::FastWriter ()
283- : yamlCompatiblityEnabled_(false ), dropNullPlaceholders_( false ) {}
283+ : yamlCompatiblityEnabled_(false ) {}
284284
285285void FastWriter::enableYAMLCompatibility () { yamlCompatiblityEnabled_ = true ; }
286286
287- void FastWriter::dropNullPlaceholders () { dropNullPlaceholders_ = true ; }
288-
289287std::string FastWriter::write (const Value& root) {
290288 document_ = " " ;
291289 writeValue (root);
@@ -296,8 +294,7 @@ std::string FastWriter::write(const Value& root) {
296294void FastWriter::writeValue (const Value& value) {
297295 switch (value.type ()) {
298296 case nullValue:
299- if (!dropNullPlaceholders_)
300- document_ += " null" ;
297+ document_ += " null" ;
301298 break ;
302299 case intValue:
303300 document_ += valueToString (value.asLargestInt ());
Original file line number Diff line number Diff line change @@ -1619,17 +1619,6 @@ JSONTEST_FIXTURE(ValueTest, zeroesInKeys) {
16191619 }
16201620}
16211621
1622- struct WriterTest : JsonTest::TestCase {};
1623-
1624- JSONTEST_FIXTURE (WriterTest, dropNullPlaceholders) {
1625- Json::FastWriter writer;
1626- Json::Value nullValue;
1627- JSONTEST_ASSERT (writer.write (nullValue) == " null\n " );
1628-
1629- writer.dropNullPlaceholders ();
1630- JSONTEST_ASSERT (writer.write (nullValue) == " \n " );
1631- }
1632-
16331622struct StreamWriterTest : JsonTest::TestCase {};
16341623
16351624JSONTEST_FIXTURE (StreamWriterTest, dropNullPlaceholders) {
@@ -2251,7 +2240,6 @@ int main(int argc, const char* argv[]) {
22512240 JSONTEST_REGISTER_FIXTURE (runner, ValueTest, zeroes);
22522241 JSONTEST_REGISTER_FIXTURE (runner, ValueTest, zeroesInKeys);
22532242
2254- JSONTEST_REGISTER_FIXTURE (runner, WriterTest, dropNullPlaceholders);
22552243 JSONTEST_REGISTER_FIXTURE (runner, StreamWriterTest, dropNullPlaceholders);
22562244 JSONTEST_REGISTER_FIXTURE (runner, StreamWriterTest, writeZeroes);
22572245
You can’t perform that action at this time.
0 commit comments