Class JSONSerializer

More text is a basic JSON serializer and deserializer that deals with standard .NET types. Unlike the MS Ajax JSONSerializer parser this parser support serialization and deserialization without explicit type markup in the JSON resulting in a simpler two-way model.

The inbound model for complex types is based on Reflection parsing of properties.

System.Object
  Westwind.Web.Controls.JSONSerializer

public class JSONSerializer : object

Class Members

MemberDescription
Constructor
Deserialize Takes a JSON string and attempts to create a .NET object from this structure. An input type is required and any type that is serialized to must support a parameterless constructor.
public object Deserialize( string JSONText,
Type ValueType );

public TType Deserialize( string jsonText );

ParseArray Parses a JSON array string to its underlying array type. Requires: - Array must be of a single element type (ie. an object, or string or decimal)
public object ParseArray( StringReader Reader,
Type ArrayType );
ParseNumber
public object ParseNumber( string value,
Type valueType );

public bool ParseNumber( string value,
ref object result );

ParseString Parses a JSON string into a string value
public string ParseString( string value );
Serialize Serializes a .NET object reference into a JSON string.
public string Serialize( object Value );
WriteValue Serialization routine that takes any value and serializes it into JSON.
public void WriteValue( StringBuilder sb,
object val );
SerializeDateAsString Determines whether dates are serialized as an encoded string value or as live new Data(ticks) expression.
SerializeDateAsString Encodes Dates as a JSON string value that is compatible with MS AJAX and is safe for JSON validators. If false serializes dates as new Date() instead.

Requirements

Namespace: Westwind.Web.Controls
Assembly: westwind.ajaxtoolkit.dll


  Last Updated: 2/21/2008 | © West Wind Technologies, 2008