Json.Write Method
Converts a data object to a string in JavaScript Object Notation (JSON) format and adds the string to the specified TextWriter object.
Namespace: System.Web.Helpers
Assembly: System.Web.Helpers (in System.Web.Helpers.dll)
Syntax
'Declaration
Public Shared Sub Write ( _
value As Object, _
writer As TextWriter _
)
'Usage
Dim value As Object
Dim writer As TextWriter
Json.Write(value, writer)
public static void Write(
Object value,
TextWriter writer
)
public:
static void Write(
Object^ value,
TextWriter^ writer
)
static member Write :
value:Object *
writer:TextWriter -> unit
public static function Write(
value : Object,
writer : TextWriter
)
Parameters
- value
Type: System.Object
The data object to convert.
- writer
Type: System.IO.TextWriter
The object that contains the converted JSON data.
Remarks
The Write method is like the Encode(Object) method, except that the Write method does not return its output as a string. Instead, it adds the output to the object in the writer parameter, which is an object based on the TextWriter class. For example, you can use a StringWriter object or a StreamWriter object for the writer parameter. By using the Write method, you can store the JSON-encoded output, customize it, and then use it for programming tasks such as writing to the response stream or writing to a file.