New to Telerik ReportingStart a free 30-day trial

Serializes and deserializes objects into and from JSON. This class is dedicated for serializing and deserializing objects only from the Telerik.Reporting namespace.

Definition

Namespace:Telerik.Reporting.JsonSerialization

Assembly:Telerik.Reporting.JsonSerialization.dll

Syntax:

C#
public class ReportJsonSerializer

Inheritance: objectReportJsonSerializer

Constructors

Initializes a new instance of the ReportJsonSerializer class.

C#
public ReportJsonSerializer()

Methods

Deserializes the JSON document contained by the specified Stream.

C#
public IReportDocument Deserialize(Stream stream)
Parameters:streamStream

The 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 Stream class, which is designed to write to streams. Classes that derive from the Stream class include: BufferedStream, FileStream, MemoryStream, etc.

Deserializes the JSON string to a report document.

C#
public IReportDocument Deserialize(string value)
Parameters:valuestring

The string that contains the JSON document.

Returns:

IReportDocument

The IReportDocument object being deserialized.

C#
public IReportDocument Deserialize(TextReader reader)
Parameters:readerTextReaderReturns:

IReportDocument

Deserializes the JSON string to a specified instance of T.

C#
public T Deserialize<T>(string value) where T : class
Parameters:valuestring

The string that contains the JSON document.

Returns:

T

The Telerik.Reporting object being deserialized.

Serializes the specified value and writes the JSON document to the specified Stream.

C#
public void Serialize(Stream stream, object value, Formatting formatting = 0)
Parameters:streamStream

The Stream used to write the JSON document.

valueobject

The value to serialize.

formattingFormatting

Specifies formatting options for the JsonTextWriter. Default is Formatting.None.

Serializes the specified value and writes the JSON document to a file with the specified file name.

C#
public void Serialize(string fileName, object value, Formatting formatting = 0)
Parameters:fileNamestring

The file which you want to write to. The ReportJsonSerializer creates a file at the specified path and writes to it in JSON text syntax. The fileName must be a file system path.

valueobject

The value to serialize.

formattingFormatting

Serializes the specified value and writes the JSON document to the specified TextWriter.

C#
public void Serialize(TextWriter writer, object value, Formatting formatting = 0)
Parameters:writerTextWriter

The TextWriter used to write the JSON document.

valueobject

The value to serialize.

formattingFormatting

Specifies formatting options for the JsonTextWriter. Default is Formatting.None.