Class NewtonsoftJsonSerializer
Class for serialization and deserialization of JSON documents using the Newtonsoft Library.
Inheritance
System.Object
NewtonsoftJsonSerializer
Assembly: Google.Apis.Core.dll
Syntax
public class NewtonsoftJsonSerializer : object, IJsonSerializer, ISerializer
Constructors
NewtonsoftJsonSerializer()
Constructs a new instance with the default serialization settings, equivalent to Instance.
Declaration
public NewtonsoftJsonSerializer()
NewtonsoftJsonSerializer(JsonSerializerSettings)
Constructs a new instance with the given settings.
Declaration
public NewtonsoftJsonSerializer(JsonSerializerSettings settings)
Parameters
Type |
Name |
Description |
Newtonsoft.Json.JsonSerializerSettings |
settings |
The settings to apply when serializing and deserializing. Must not be null.
|
Properties
Gets the application format this serializer supports (e.g. "json", "xml", etc.).
Declaration
public string Format { get; }
Property Value
Type |
Description |
System.String |
|
Instance
The default instance of the Newtonsoft JSON Serializer, with default settings.
Declaration
public static NewtonsoftJsonSerializer Instance { get; }
Property Value
Methods
CreateDefaultSettings()
Declaration
public static JsonSerializerSettings CreateDefaultSettings()
Returns
Type |
Description |
Newtonsoft.Json.JsonSerializerSettings |
A new set of default settings.
|
Deserialize(String, Type)
Deserializes the string into an object.
Declaration
public object Deserialize(string input, Type type)
Parameters
Type |
Name |
Description |
System.String |
input |
|
System.Type |
type |
|
Returns
Type |
Description |
System.Object |
|
Deserialize<T>(Stream)
Deserializes the stream into an object.
Declaration
public T Deserialize<T>(Stream input)
Parameters
Type |
Name |
Description |
System.IO.Stream |
input |
|
Returns
Type Parameters
Deserialize<T>(String)
Deserializes the string into an object.
Declaration
public T Deserialize<T>(string input)
Parameters
Type |
Name |
Description |
System.String |
input |
|
Returns
Type Parameters
Serialize(Object)
Serializes the specified object into a string.
Declaration
public string Serialize(object obj)
Parameters
Type |
Name |
Description |
System.Object |
obj |
|
Returns
Type |
Description |
System.String |
|
Serialize(Object, Stream)
Serializes the specified object into a Stream.
Declaration
public void Serialize(object obj, Stream target)
Parameters
Type |
Name |
Description |
System.Object |
obj |
|
System.IO.Stream |
target |
|
Implements
Extension Methods