title: Convert MongoDB BsonDocument to valid JSON in C#
body: <p>I am working with the MongoDB C# driver. I have a <code>BsonDocument</code> with some data which includes some MongoDB-specific types (like ObjectIDs and ISODates). I want to convert this to a valid general-purpose JSON string. In other words, I can't have something like <code>_id: ObjectId(...)</code> or <code>date: ISODate(...)</code> but would prefer <code>_id: "..."</code> and <code>date: "..."</code>. Basically, I want to convert these special types that only MongoDB recognizes to regular strings so they can be parsed more easily. The problem is that a built-in function like <code>.ToJson()</code> (which another StackOverflow answer suggests) doesn't really convert the document to valid JSON at all because it maintains these special types. My document also contains many levels of arrays and sub-documents, so a simple for loop will not suffice. What's the best way to convert a <code>BsonDocument</code> that avoids this problem? I would prefer something built-in rather than manually recursing through the document to fix all the issues. </p>