JsonWriterSettings jsonWriterSettings = new JsonWriterSettings();
jsonWriterSettings.OutputMode = JsonOutputMode.Strict;
var a = docs.ToJson(jsonWriterSettings);
对于objectId类型和时间类型转化出来是这样
[{ "_id" : { "$oid" : "5da97496532e46bef095b9fe" }, "time" : { "$date" : 1571386506000 }, "picture_1" : "123", "picture_2" : "123", "picture_3" : "123", "picture_4" : "123", "goodsintro" : "123", "deletestate" : 0, "state" : "上架", "realsold" : 0, "inventory" : "0", "totalsold" : 0 }]
var a = docs.ToJson();
则是这种
{"_id" : ObjectId("5001047632e3988ad237a206"), "name" : "xx", "date" : ISODate("2012-07-14T05:32:38.189Z")}
使用的驱动是 MongoDB.Driver;MongoDB.Bson;MongoDB.Bson.IO;
那么对于ObjectId 和 ISODate 时间的问题我该如何序列化成正常的json呢?
你好哈哈哈哈哈
顶一下
– WeiYongZhi 5年前