Skip to content

Commit 47fea5d

Browse files
author
Chris Cho
committed
PR review fixes
1 parent b4e42b9 commit 47fea5d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

source/fundamentals/data-formats/document-data-format-extended-json.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ an example Extended JSON string into a ``Document`` object using the
137137
String ejsonStr = "{ \"_id\": { \"$oid\": \"507f1f77bcf86cd799439011\"}," +
138138
"\"myNumber\": {\"$numberLong\": \"4794261\" }}}";
139139

140-
Document doc = new Document(Document.parse(ejsonStr));
140+
Document doc = Document.parse(ejsonStr);
141141
System.out.println(doc);
142142

143143
The output of the code above resembles the following:
@@ -203,31 +203,31 @@ Using the Document Classes
203203
~~~~~~~~~~~~~~~~~~~~~~~~~~
204204

205205
You can write an Extended JSON string from an instance of ``Document`` or
206-
``BsonDocument`` by calling the ``toJson()`` method, passing it an instance of
207-
``JsonWriterSettings`` to specify the Extended JSON format.
206+
``BsonDocument`` by calling the ``toJson()`` method, optionally passing it an
207+
instance of ``JsonWriterSettings`` to specify the Extended JSON format.
208208

209-
In this example, we output the Extended JSON in the "Shell" format.
209+
In this example, we output the Extended JSON in the "Relaxed" format.
210210

211211
.. code-block:: java
212212

213213
Document myDoc = new Document();
214214
myDoc.append("_id", new ObjectId("507f1f77bcf86cd799439012")).append("myNumber", 11223344);
215215

216-
JsonWriterSettings settings = JsonWriterSettings.builder().outputMode(JsonMode.SHELL).build();
216+
JsonWriterSettings settings = JsonWriterSettings.builder().outputMode(JsonMode.RELAXED).build();
217217
System.out.println(doc.toJson(settings));
218218

219219
The output of this code example resembles the following:
220220

221221
.. code-block:: none
222222
:copyable: false
223223

224-
{"_id": ObjectId("507f1f77bcf86cd799439011"), "myNumber": NumberLong(4794261)}
224+
{"_id": {"$oid": "507f1f77bcf86cd799439012"}, "myNumber": 11223344}
225225

226226
Using the BSON Library
227227
~~~~~~~~~~~~~~~~~~~~~~
228228

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>`
229+
You can also output an Extended JSON string from data in Java objects using
230+
the BSON library with the :java-docs:`JsonWriter </apidocs/bson/org/bson/json/JsonWriter.html>`
231231
class. To construct an instance of ``JsonWriter``, pass a subclass of a Java
232232
``Writer`` to specify how you want to output the Extended JSON. You can
233233
optionally pass a :java-docs:`JsonWriterSettings </apidocs/bson/org/bson/json/JsonWriterSettings.html>`

0 commit comments

Comments
 (0)