When overridden in a derived class, builds a dictionary of name/value pairs.
Syntax
CSharp
VisualBasic
ManagedCPlusPlus
JSharp
Parameters
- obj (Object)
The Object to serialize.
- serializer (JavaScriptSerializer)
The JavaScriptSerializer responsible for the serialization.
Return Value
Return Value
An IDictionary object that contains key/value pairs that represent the object’s data.
Remarks
When serializing a type for which a custom converter is registered, the JavaScriptSerializer instance will invoke the Serialize(Object, JavaScriptSerializer) method.
Notes For Inheritors
The return value of Serialize(Object, JavaScriptSerializer) must be an IDictionary instance with zero or more name/value pairs that represent an object’s data that will be converted to JSON. Note that the converter itself does not serialize data as JSON. Instead, the converter builds a dictionary of name/value pairs that contain the property names (the string key for the dictionary) and corresponding property values (the object value in the dictionary). The JavaScriptSerializer instance subsequently converts these to JSON.
If the converter encounters an exception, it should throw an InvalidOperationException that describes the problem.
Assembly: System.Web.Extensions (Module: System.Web.Extensions)