This code converts a BsonDocument to JSON using:
BsonDocument bson = new { Name = "someone" }.ToBsonDocument();
string json = bson.ToJson(new JsonWriterSettings { OutputMode = JsonOutputMode.RelaxedExtendedJson });
json.Should().Be("{name:\"someone\"}");
The expected JSON output is {name:"someone"}
, but the actual output contains spaces as { name : "someone" }
.
I am concerned about the potential impact on bandwidth usage due to these unnecessary spaces in the JSON output. How I can ensure that the output matches the expected format without unnecessary spaces?