@@ -119,11 +119,14 @@ corresponds to the format of the example you want to see:
119
119
Read Extended JSON
120
120
------------------
121
121
122
- You can read an Extended JSON string into Java objects with the BSON library
123
- by calling the ``parse()`` static method from either the ``Document`` or
124
- ``BsonDocument`` class, depending on which object type you need. This method
125
- parses the Extended JSON string in any of the formats and returns an instance
126
- of that class containing the data.
122
+ Using the Document Classes
123
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
124
+
125
+ You can read an Extended JSON string into Java document objects by calling
126
+ the ``parse()`` static method from either the ``Document`` or ``BsonDocument``
127
+ class, depending on which object type you need. This method parses the Extended
128
+ JSON string in any of the formats and returns an instance of that class
129
+ containing the data.
127
130
128
131
The following example shows how you can use the ``Document`` class to read
129
132
an example Extended JSON string into a ``Document`` object using the
@@ -147,8 +150,8 @@ The output of the code above resembles the following:
147
150
For more information on the driver document classes, see our Fundamentals page
148
151
on :doc:`Documents </fundamentals/data-formats/documents>`.
149
152
150
- Read Extended JSON using the BSON Library
151
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
153
+ Using the BSON Library
154
+ ~~~~~~~~~~~~~~~~~~~~~~
152
155
153
156
You can also read an Extended JSON string into Java objects without using
154
157
the MongoDB driver's document classes by using the
@@ -196,6 +199,9 @@ section, see the following API documentation:
196
199
Write Extended JSON
197
200
-------------------
198
201
202
+ Using the Document Classes
203
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
204
+
199
205
You can write an Extended JSON string from an instance of ``Document`` or
200
206
``BsonDocument`` by calling the ``toJson()`` method, passing it an instance of
201
207
``JsonWriterSettings`` to specify the Extended JSON format.
@@ -217,13 +223,12 @@ The output of this code example resembles the following:
217
223
218
224
{"_id": ObjectId("507f1f77bcf86cd799439011"), "myNumber": NumberLong(4794261)}
219
225
220
- Write Extended JSON using the BSON Library
221
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
226
+ Using the BSON Library
227
+ ~~~~~~~~~~~~~~~~~~~~~~
222
228
223
- You can also read an Extended JSON string into Java objects without using
224
- the MongoDB driver's document classes by using the
225
- :java-docs:`JsonWriter </apidocs/bson/org/bson/json/JsonWriter.html>` class.
226
- To construct an instance of ``JsonWriter``, pass a subclass of a Java
229
+ You can also read an Extended JSON string into Java objects using the BSON
230
+ library directly with the :java-docs:`JsonWriter </apidocs/bson/org/bson/json/JsonWriter.html>`
231
+ class. To construct an instance of ``JsonWriter``, pass a subclass of a Java
227
232
``Writer`` to specify how you want to output the Extended JSON. You can
228
233
optionally pass a :java-docs:`JsonWriterSettings </apidocs/bson/org/bson/json/JsonWriterSettings.html>`
229
234
instance to specify options such as the Extended JSON format. By default, the
0 commit comments