MongoDB Issues Deserializing JArray

Viewed 790

I'm getting following exceptions:

  • An error occurred while deserializing the Value property of class ExampleClass: Type 'Newtonsoft.Json.Linq.JToken' does not have a suitable constructor or Add method.

  • MongoDB.Bson.BsonSerializationException: Type 'Newtonsoft.Json.Linq.JToken' does not have a suitable constructor or Add method.

And it looks like the issue happens when it tries to read an entry from MongoDB, which has this "Value" key:

"Value": {
    "_t": "Newtonsoft.Json.Linq.JArray, Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed",
    "_v": [{
            "_t": "JValue",
            "_v": []
    }, {
            "_t": "JValue",
            "_v": []
    }]
}

"Value" is an object: public object Value { get; set; }.

I'm a bit stuck here since was researching this issue for 1.5 days now, so any insights appreciated!

PS.: It looks like "_v": [] are empty, but it shouldn't be, probably meaning that it fails to insert entry properly due to same exception?..

0 Answers
Related