Search Results for

    Show / Hide Table of Contents

    Class NewtonSoftJsonSerializerSettings

    A typed settings for a NewtonSoftJsonSerializer class.

    Inheritance
    object
    NewtonSoftJsonSerializerSettings
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Akka.Serialization
    Assembly: Akka.dll
    Syntax
    public sealed class NewtonSoftJsonSerializerSettings

    Constructors

    | Edit this page View Source

    NewtonSoftJsonSerializerSettings(bool, bool, IEnumerable<Type>, bool, int, int)

    Creates a new instance of the NewtonSoftJsonSerializerSettings.

    Declaration
    public NewtonSoftJsonSerializerSettings(bool encodeTypeNames, bool preserveObjectReferences, IEnumerable<Type> converters, bool usePooledStringBuilder, int stringBuilderMinSize, int stringBuilderMaxSize)
    Parameters
    Type Name Description
    bool encodeTypeNames

    Determines if a special $type field should be emitted into serialized JSON. Must be true if corresponding serializer is used as default.

    bool preserveObjectReferences

    Determines if object references should be tracked within serialized object graph. Must be true if corresponding serialize is used as default.

    IEnumerable<Type> converters

    A list of types implementing a Newtonsoft.Json.JsonConverter to support custom types serialization.

    bool usePooledStringBuilder

    Determines if string builders will be used from a pool to lower memory usage

    int stringBuilderMinSize

    Starting size used for pooled string builders if enabled

    int stringBuilderMaxSize

    Max retained size used for pooled string builders if enabled

    Fields

    | Edit this page View Source

    Default

    A default instance of NewtonSoftJsonSerializerSettings used when no custom configuration has been provided.

    Declaration
    public static readonly NewtonSoftJsonSerializerSettings Default
    Field Value
    Type Description
    NewtonSoftJsonSerializerSettings

    Properties

    | Edit this page View Source

    Converters

    A collection of an additional converter types to be applied to a NewtonSoftJsonSerializer. Converters must inherit from Newtonsoft.Json.JsonConverter class and implement a default constructor.

    Declaration
    public IEnumerable<Type> Converters { get; }
    Property Value
    Type Description
    IEnumerable<Type>
    | Edit this page View Source

    EncodeTypeNames

    When true, serializer will encode a type names into serialized json $type field. This must be true if NewtonSoftJsonSerializer is a default serializer in order to support polymorphic deserialization.

    Declaration
    public bool EncodeTypeNames { get; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    PreserveObjectReferences

    When true, serializer will track a reference dependencies in serialized object graph. This must be true if NewtonSoftJsonSerializer.

    Declaration
    public bool PreserveObjectReferences { get; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    StringBuilderMaxSize

    The Max Retained size for Pooled StringBuilders, if UsePooledStringBuilder is -true-

    Declaration
    public int StringBuilderMaxSize { get; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    StringBuilderMinSize

    The Starting size used for Pooled StringBuilders, if UsePooledStringBuilder is -true-

    Declaration
    public int StringBuilderMinSize { get; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    UsePooledStringBuilder

    If -true-, Stringbuilders are pooled and reused for serialization to lower memory pressure.

    Declaration
    public bool UsePooledStringBuilder { get; }
    Property Value
    Type Description
    bool

    Methods

    | Edit this page View Source

    Create(Config)

    Creates a new instance of the NewtonSoftJsonSerializerSettings based on a provided config. Config may define several key-values:

    • `encode-type-names` (boolean) mapped to EncodeTypeNames
    • `preserve-object-references` (boolean) mapped to PreserveObjectReferences
    • `converters` (type list) mapped to Converters. They must implement Newtonsoft.Json.JsonConverter and define either default constructor or constructor taking ExtendedActorSystem as its only parameter.
    Declaration
    public static NewtonSoftJsonSerializerSettings Create(Config config)
    Parameters
    Type Name Description
    Config config
    Returns
    Type Description
    NewtonSoftJsonSerializerSettings
    Exceptions
    Type Condition
    ArgumentNullException

    Raised when no config was provided.

    ArgumentException

    Raised when types defined in converters list didn't inherit Newtonsoft.Json.JsonConverter.

    Extension Methods

    ObjectExtensions.IsDefaultForType<T>(T)
    ObjectExtensions.AsOption<T>(T)
    Extensions.AsInstanceOf<T>(object)
    In this article
    • githubEdit this page
    • View Source
    Back to top
    Contribute
    • Project Chat
    • Discussion Forum
    • Source Code
    Support
    • Akka.NET Support Plans
    • Akka.NET Observability Tools
    • Akka.NET Training & Consulting
    Maintained By
    • Petabridge - The Akka.NET Company
    • Learn Akka.NET