[SERVER-8545] JSON values of quotes not parsed correctly by JSON to BSON parser Created: 13/Feb/13  Updated: 09/Apr/13  Resolved: 03/Apr/13

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Andrew Emil (Inactive) Assignee: Shaun Verch
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Operating System: ALL
Steps To Reproduce:

add the following test to jsontests.cpp

class QuoteTest6 : public Base {
virtual BSONObj bson() const

{ BSONObjBuilder b; b.append("test", '"'); return b.obj(); }

virtual string json() const {
return "

{ \"test\" : '\"' }

";
}
};

and the output is

JsonTests::FromJsonTests::QuoteTest6 Expected: !expected.woCompare( actual ) @src/mongo/dbtests/jsontests.cpp:439

Participants:

 Comments   
Comment by Shaun Verch [ 03/Apr/13 ]

b.append("test", '"');

actually is appending type char. Changing the test to:

b.append("test", "\"");

Makes it succeed. This is correct behavior because double quotes indicate a string in our JSON format.

Generated at Thu Feb 08 03:17:44 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.