Convert MongoDB BsonDocument to valid JSON in C#

后端 未结 10 2539
旧巷少年郎
旧巷少年郎 2020-12-01 14:16

I am working with the MongoDB C# driver. I have a BsonDocument with some data which includes some MongoDB-specific types (like ObjectIDs and ISODates). I want t

10条回答
  •  有刺的猬
    2020-12-01 15:07

    Most of the Time for this I use, Json.NET

    JsonConvert.SerializeObject(obj); 
    

    Most of the time that does the trick. If need be you can set some JsonSerializerSettings

提交回复
热议问题