BsonExtensionMethodsToJson Method (Object, Type, JsonWriterSettings)MongoDB C# Driver API Documentation
Converts an object to a JSON string.

Namespace: MongoDB.Bson
Assembly: MongoDB.Bson (in MongoDB.Bson.dll) Version: { version: '1.11.0.92', semver: '1.11.0', commit: '791a16588d4a8b3b118a8b3b57cfa436fec5d3da', commitDate: '2015-12-08 22:55:45' }
Syntax

public static string ToJson(
	this Object obj,
	Type nominalType,
	JsonWriterSettings settings
)

Parameters

obj
Type: SystemObject
The object.
nominalType
Type: SystemType
The nominal type of the object.
settings
Type: MongoDB.Bson.IOJsonWriterSettings
The JsonWriter settings.

Return Value

Type: String
A JSON string.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Object. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference