File tree 1 file changed +21
-1
lines changed
1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -115,4 +115,24 @@ Version 3.0 Breaking Changes
115
115
apply the ``[BsonRepresentation(BsonType.String)]`` attribute to the field.
116
116
117
117
To learn more about specifying BSON types during serialization, see the
118
- :ref:`Custom Serialization <csharp-custom-serialization>` section of the POCOs page.
118
+ :ref:`Custom Serialization <csharp-custom-serialization>` section of the POCOs page.
119
+
120
+ - The default JSON output mode is Relaxed Extended JSON, a string format based on the
121
+ JSON standard that describes BSON documents. Relaxed Extended JSON emphasizes
122
+ readability and interoperability at the expense of type preservation.
123
+
124
+ To use a different JSON output mode, create a new ``JsonWriterSettings`` object. Set
125
+ the ``OutputMode`` property of this object to a value from the ``JsonOutputMode`` enum,
126
+ then pass the object to the ``ToJson()`` method when you serialize your document.
127
+ The following code example shows how to serialize a BSON document to Strict JSON:
128
+
129
+ .. code-block:: csharp
130
+
131
+ // Configure JsonWriterSettings
132
+ var jsonWriterSettings = new JsonWriterSettings
133
+ {
134
+ OutputMode = JsonOutputMode.Strict
135
+ };
136
+
137
+ // Serialize the document to JSON using the configured settings
138
+ var json = document.ToJson(jsonWriterSettings);
You can’t perform that action at this time.
0 commit comments