3

I am trying to convert a JSOn string into a Mongo document and there is not much help availabel online.

the only helpful thing that I found was:

1: 2:

MongoDB.Bson.BsonDocument doc4=MongoDB.Bson.Serialization .BsonSerializer.Deserialize(genericjson);

Toggle HighlightingOpen in New WindowSelect All

as described in the post @

Convert string into MongoDB BsonDocument

It creates the document in the databse but it's not the simulation of what it is here in C#. When I click on the nodes they don't show me the data inside. this is what Mongo does when the conversion has corrupted the file.

is there any other way to solve it?

Community
  • 1
  • 1
Lost
  • 12,007
  • 32
  • 121
  • 193

1 Answers1

4

Try the BsonDocument.Parse() method, e.g.

var bsonDoc = BsonDocument.Parse(jsonString);
Chris Fulstow
  • 41,170
  • 10
  • 86
  • 110