Table of Contents

Class JsonSerializable

Namespace
Microsoft.Azure.Documents
Assembly
Microsoft.Azure.Documents.Client.dll

Represents the base class for Azure Cosmos DB database objects and provides methods for serializing and deserializing from JSON.

public abstract class JsonSerializable
Inheritance
JsonSerializable
Derived
Inherited Members
Extension Methods

Methods

LoadFrom(JsonReader)

Loads the object from the specified JSON reader in the Azure Cosmos DB service.

public virtual void LoadFrom(JsonReader reader)

Parameters

reader JsonReader

Loads the object from this JSON reader.

LoadFrom(JsonReader, JsonSerializerSettings)

Loads the object from the specified JSON reader in the Azure Cosmos DB service.

public virtual void LoadFrom(JsonReader reader, JsonSerializerSettings serializerSettings)

Parameters

reader JsonReader

Loads the object from this JSON reader.

serializerSettings JsonSerializerSettings

The JsonSerializerSettings to be used.

LoadFromWithConstructor<T>(Stream, Func<T>)

Deserializes the specified stream using the given constructor in the Azure Cosmos DB service.

public static T LoadFromWithConstructor<T>(Stream stream, Func<T> constructorFunction)

Parameters

stream Stream

The stream to load from.

constructorFunction Func<T>

The constructor used for the returning object.

Returns

T

The object loaded from the specified stream.

Type Parameters

T

The type of the object.

LoadFromWithConstructor<T>(Stream, Func<T>, JsonSerializerSettings)

Deserializes the specified stream using the given constructor in the Azure Cosmos DB service.

public static T LoadFromWithConstructor<T>(Stream stream, Func<T> constructorFunction, JsonSerializerSettings settings)

Parameters

stream Stream

The stream to load from.

constructorFunction Func<T>

The constructor used for the returning object.

settings JsonSerializerSettings

The JsonSerializerSettings to be used.

Returns

T

The object loaded from the specified stream.

Type Parameters

T

The type of the object.

LoadFrom<T>(Stream)

Loads the object from the specified stream in the Azure Cosmos DB service.

public static T LoadFrom<T>(Stream stream) where T : JsonSerializable, new()

Parameters

stream Stream

The stream to load from.

Returns

T

The object loaded from the specified stream.

Type Parameters

T

The type of the returning object.

SaveTo(Stream, SerializationFormattingPolicy)

Saves the object to the specified stream in the Azure Cosmos DB service.

public void SaveTo(Stream stream, SerializationFormattingPolicy formattingPolicy = SerializationFormattingPolicy.None)

Parameters

stream Stream

Saves the object to this output stream.

formattingPolicy SerializationFormattingPolicy

Uses an optional serialization formatting policy when saving the object. The default policy is set to None.

SaveTo(Stream, SerializationFormattingPolicy, JsonSerializerSettings)

Saves the object to the specified stream in the Azure Cosmos DB service.

public void SaveTo(Stream stream, SerializationFormattingPolicy formattingPolicy, JsonSerializerSettings settings)

Parameters

stream Stream

Saves the object to this output stream.

formattingPolicy SerializationFormattingPolicy

Uses a custom serialization formatting policy when saving the object.

settings JsonSerializerSettings

The serializer settings to use.

ToString()

Returns the string representation of the object in the Azure Cosmos DB service.

public override string ToString()

Returns

string

The string representation of the object.