Interface IJsonSerializer
Namespace: MediaBrowser.Model.Serialization
Assembly: MediaBrowser.Model.dll
Syntax
public interface IJsonSerializer
Methods
DeserializeFromBytes(ReadOnlySpan<Byte>, Type)
Declaration
object DeserializeFromBytes(ReadOnlySpan<byte> bytes, Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| System.ReadOnlySpan<System.Byte> | bytes | |
| System.Type | type |
Returns
| Type | Description |
|---|---|
| System.Object |
DeserializeFromBytes<T>(ReadOnlySpan<Byte>)
Declaration
T DeserializeFromBytes<T>(ReadOnlySpan<byte> bytes)
Parameters
| Type | Name | Description |
|---|---|---|
| System.ReadOnlySpan<System.Byte> | bytes |
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| T |
DeserializeFromFile<T>(String)
Deserializes from file.
Declaration
T DeserializeFromFile<T>(string file)
where T : class
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | file | The file. |
Returns
| Type | Description |
|---|---|
| T | ``0. |
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | file |
DeserializeFromFileAsync(Type, String)
Deserializes from file.
Declaration
Task<object> DeserializeFromFileAsync(Type type, string file)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | type | The type. |
| System.String | file | The file. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.Object> | System.Object. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | type |
DeserializeFromFileAsync<T>(String)
Declaration
Task<T> DeserializeFromFileAsync<T>(string file)
where T : class
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | file |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<T> |
Type Parameters
| Name | Description |
|---|---|
| T |
DeserializeFromSpan(ReadOnlySpan<Char>, Type)
Declaration
object DeserializeFromSpan(ReadOnlySpan<char> json, Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| System.ReadOnlySpan<System.Char> | json | |
| System.Type | type |
Returns
| Type | Description |
|---|---|
| System.Object |
DeserializeFromSpan<T>(ReadOnlySpan<Char>)
Declaration
T DeserializeFromSpan<T>(ReadOnlySpan<char> text)
Parameters
| Type | Name | Description |
|---|---|---|
| System.ReadOnlySpan<System.Char> | text |
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| T |
DeserializeFromStream(Stream, Type)
Deserializes from stream.
Declaration
object DeserializeFromStream(Stream stream, Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | The stream. |
| System.Type | type | The type. |
Returns
| Type | Description |
|---|---|
| System.Object | System.Object. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | stream |
DeserializeFromStream<T>(Stream)
Deserializes from stream.
Declaration
T DeserializeFromStream<T>(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | The stream. |
Returns
| Type | Description |
|---|---|
| T | ``0. |
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | stream |
DeserializeFromStreamAsync(Stream, Type)
Declaration
Task<object> DeserializeFromStreamAsync(Stream stream, Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | |
| System.Type | type |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.Object> |
DeserializeFromStreamAsync<T>(Stream)
Declaration
Task<T> DeserializeFromStreamAsync<T>(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<T> |
Type Parameters
| Name | Description |
|---|---|
| T |
DeserializeFromString(String, Type)
Deserializes from string.
Declaration
object DeserializeFromString(string json, Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | json | The json. |
| System.Type | type | The type. |
Returns
| Type | Description |
|---|---|
| System.Object | System.Object. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | json |
DeserializeFromString<T>(String)
Deserializes from string.
Declaration
T DeserializeFromString<T>(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | The text. |
Returns
| Type | Description |
|---|---|
| T | ``0. |
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | text |
DeserializePartialJsonInto(String, Object)
Declaration
void DeserializePartialJsonInto(string json, object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | json | |
| System.Object | obj |
SerializeToFile(Object, String)
Serializes to file.
Declaration
void SerializeToFile(object obj, string file)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The obj. |
| System.String | file | The file. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | obj |
SerializeToFile(Object, String, JsonSerializerOptions)
Serializes to file.
Declaration
void SerializeToFile(object obj, string file, JsonSerializerOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The obj. |
| System.String | file | The file. |
| JsonSerializerOptions | options | The options. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | obj |
SerializeToSpan(Object)
Declaration
ReadOnlySpan<char> SerializeToSpan(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj |
Returns
| Type | Description |
|---|---|
| System.ReadOnlySpan<System.Char> |
SerializeToStream(Object, Stream)
Serializes to stream.
Declaration
void SerializeToStream(object obj, Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The obj. |
| System.IO.Stream | stream | The stream. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | obj |
SerializeToStream(Object, Stream, JsonSerializerOptions)
Serializes to stream.
Declaration
void SerializeToStream(object obj, Stream stream, JsonSerializerOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The obj. |
| System.IO.Stream | stream | The stream. |
| JsonSerializerOptions | options | The options. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | obj |
SerializeToStreamAsync(Object, Stream)
Serializes JSON to a stream asynchronously, leaving the stream open.
Declaration
Task SerializeToStreamAsync(object obj, Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The object to serialize. |
| System.IO.Stream | stream | The destination stream. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task |
SerializeToStreamAsync(Object, Stream, JsonSerializerOptions)
Serializes JSON to a stream asynchronously with the specified options, leaving the stream open.
Declaration
Task SerializeToStreamAsync(object obj, Stream stream, JsonSerializerOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The object to serialize. |
| System.IO.Stream | stream | The destination stream. |
| JsonSerializerOptions | options | The serialization options. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task |
SerializeToString(Object)
Serializes to string.
Declaration
string SerializeToString(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The obj. |
Returns
| Type | Description |
|---|---|
| System.String | System.String. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | obj |
SerializeToString(Object, JsonSerializerOptions)
Serializes to string.
Declaration
string SerializeToString(object obj, JsonSerializerOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The obj. |
| JsonSerializerOptions | options | The options. |
Returns
| Type | Description |
|---|---|
| System.String | System.String. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | obj |