Bson array (de)serialization with Json.NET

后端 未结 5 982
再見小時候
再見小時候 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:12

    In general, you could check data type first before set ReadRootValueAsArray to true, like this:

    if (typeof(IEnumerable).IsAssignableFrom(type)) 
        bSonReader.ReadRootValueAsArray = true;
    

提交回复
热议问题