Bson array (de)serialization with Json.NET

后端 未结 5 984
再見小時候
再見小時候 2020-12-07 01:30

I am simply trying to serialize and deserialize a string array in Bson format using Json.NET, but the following code fails:

var jsonSerializer = new JsonSeria         


        
5条回答
  •  盖世英雄少女心
    2020-12-07 02:29

    Set ReadRootValueAsArray to true on BsonReader

    http://james.newtonking.com/projects/json/help/index.html?topic=html/P_Newtonsoft_Json_Bson_BsonReader_ReadRootValueAsArray.htm

    This setting is required because the BSON data spec doesn't save metadata about whether the root value is an object or an array.

提交回复
热议问题