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.
Assembly: System.ServiceModel.Web (in System.ServiceModel.Web.dll)
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.
| Exception | Condition |
|---|---|
| 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. |
Show: