Class ReportJsonSerializer
Serializes and deserializes objects into and from JSON. This class is dedicated for serializing and deserializing objects only from the Telerik.Reporting namespace.
Inheritance
Namespace: Telerik.Reporting.JsonSerialization
Assembly: Telerik.Reporting.JsonSerialization.dll
Syntax
public class ReportJsonSerializer
Constructors
ReportJsonSerializer()
Initializes a new instance of the ReportJsonSerializer class.
Declaration
public ReportJsonSerializer()
Methods
Deserialize(Stream)
Deserializes the JSON document contained by the specified System.IO.Stream.
Declaration
public IReportDocument Deserialize(Stream stream)
Parameters
|
System.IO.Stream
stream
The System.IO.Stream that contains the JSON document to deserialize. |
Returns
|
IReportDocument
The Telerik.Reporting object being deserialized. |
Remarks
Use the stream parameter to specify an object that derives from the System.IO.Stream class, which is designed to write to streams. Classes that derive from the System.IO.Stream class include: System.IO.BufferedStream, System.IO.FileStream, System.IO.MemoryStream, etc.
Examples
The following example deserializes an object using a System.IO.Stream:
using (System.IO.FileStream fileStream = new System.IO.FileStream("Report1.xml", System.IO.FileMode.Open, System.IO.FileAccess.Read))
{
Telerik.Reporting.XmlSerialization.ReportXmlSerializer xmlSerializer =
new Telerik.Reporting.XmlSerialization.ReportXmlSerializer();
Telerik.Reporting.Report report = (Telerik.Reporting.Report)
xmlSerializer.Deserialize(fileStream);
}
Using fileStream As New System.IO.FileStream("Report1.xml", System.IO.FileMode.Open, System.IO.FileAccess.Read)
Dim xmlSerializer As New Telerik.Reporting.XmlSerialization.ReportXmlSerializer()
Dim report As Telerik.Reporting.Report = DirectCast(xmlSerializer.Deserialize(fileStream), Telerik.Reporting.Report)
End Using
Deserialize(String)
Deserializes the JSON string to a report document.
Declaration
public IReportDocument Deserialize(string value)
Parameters
|
System.String
value
The string that contains the JSON document. |
Returns
|
IReportDocument
The IReportDocument object being deserialized. |
Deserialize<T>(String)
Deserializes the JSON string to a specified instance of T.
Declaration
public T Deserialize<T>(string value)
where T : class
Parameters
|
System.String
value
The string that contains the JSON document. |
Returns
|
T
The Telerik.Reporting object being deserialized. |
Type Parameters
|
T
|
Serialize(TextWriter, Object, Formatting)
Serializes the specified value and writes the JSON document to the specified System.IO.TextWriter.
Declaration
public void Serialize(TextWriter writer, object value, Formatting formatting)
Parameters
|
System.IO.TextWriter
writer
The System.IO.TextWriter used to write the JSON document. |
|
System.Object
value
The value to serialize. |
|
Newtonsoft.Json.Formatting
formatting
Specifies formatting options for the JsonTextWriter. Default is Formatting.None. |