Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
ASP.NET Reference
Client Reference
 serialize Method

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Sys.Serialization.JavaScriptSerializer serialize Method

Converts an ECMAScript (JavaScript) object graph into a JSON string. This member is static and can be invoked without creating an instance of the class.

var result = JavaScriptSerializer.serialize(value);

Parameter

Description

value

The JavaScript object graph to serialize.

Exception type

Condition

Sys.ArgumentException

value contains a value that cannot be serialized.

The serialize method skips any properties that start with the prefix "$", because that is a special naming convention used by ASP.NET AJAX. You must make sure that any other properties of a JavaScript object have a corresponding mapping to deserialization targets on the server.

null is not an allowed value for value. If you are serializing a numeric value, you must specify a number for value. NaN and Number.Infinity are not allowed. If an invalid value is encountered, the serialize method throws an error.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker