Click or drag to resize
Json.NET

JsonConvertSerializeObject Method (Object, Type, Formatting, JsonSerializerSettings)

 
Serializes the specified object to a JSON string using a type, formatting and JsonSerializerSettings.

Namespace:  Newtonsoft.Json
Assembly:  Newtonsoft.Json (in Newtonsoft.Json.dll) Version: 12.0.1+509643a8952ce731e0207710c429ad6e67dc43db
Syntax
C#
public static string SerializeObject(
	Object value,
	Type type,
	Formatting formatting,
	JsonSerializerSettings settings
)

Parameters

value
Type: SystemObject
The object to serialize.
type
Type: SystemType
The type of the value being serialized. This parameter is used when TypeNameHandling is Auto to write out the type name if the type of the value does not match. Specifying the type is optional.
formatting
Type: Newtonsoft.JsonFormatting
Indicates how the output should be formatted.
settings
Type: Newtonsoft.JsonJsonSerializerSettings
The JsonSerializerSettings used to serialize the object. If this is null, default serialization settings will be used.

Return Value

Type: String
A JSON string representation of the object.
See Also