C# Class Jurassic.Library.JSONSerializer

Converts a value into JSON text.
ファイルを表示 Open project: paulbartrum/jurassic Class Usage Examples

Public Methods

Method Description
JSONSerializer ( ScriptEngine engine ) : System

Creates a new JSONSerializer instance with the default options.

Serialize ( object value ) : string

Serializes a value into a JSON string.

Private Methods

Method Description
QuoteString ( string input, System result ) : void

Adds double quote characters to the start and end of the given string and converts any invalid characters into escape sequences.

SerializeArray ( ArrayInstance value, StringBuilder result ) : void

Serializes an array into a JSON string.

SerializeObject ( ObjectInstance value, StringBuilder result ) : void

Serializes an object into a JSON string.

SerializePropertyValue ( object value, StringBuilder result ) : void

Serializes a value into a JSON string. Does not serialize "undefined", check for that value before calling this method.

TransformPropertyValue ( ArrayInstance holder, uint arrayIndex ) : object

Transforms the value stored in the given object using toJSON and/or the replacer function.

TransformPropertyValue ( ObjectInstance holder, string propertyName ) : object

Transforms the value stored in the given object using toJSON and/or the replacer function.

Method Details

JSONSerializer() public method

Creates a new JSONSerializer instance with the default options.
public JSONSerializer ( ScriptEngine engine ) : System
engine ScriptEngine The associated script engine.
return System

Serialize() public method

Serializes a value into a JSON string.
public Serialize ( object value ) : string
value object The value to serialize.
return string