WriteObject Method
Collapse the table of content
Expand the table of content

DataContractJsonSerializer.WriteObject Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Serializes a specified object to JavaScript Object Notation (JSON) data and writes the resulting JSON to a stream.

Namespace:  System.Runtime.Serialization.Json
Assembly:  System.ServiceModel.Web (in System.ServiceModel.Web.dll)

public void WriteObject(
	Stream stream,
	Object graph
)

Parameters

stream
Type: System.IO.Stream
The Stream that is written to.
graph
Type: System.Object
The object that contains the data to write to the stream.

ExceptionCondition
InvalidDataContractException

The type being serialized does not conform to data contract rules. For example, the DataContractAttribute attribute has not been applied to the type.

SerializationException

There is a problem with the instance being written.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft