Class NewtonSoftJsonSerializerSettings
A typed settings for a NewtonSoftJsonSerializer class.
Inherited Members
Namespace: Akka.Serialization
Assembly: Akka.dll
Syntax
public sealed class NewtonSoftJsonSerializerSettings
Constructors
| Improve this Doc View SourceNewtonSoftJsonSerializerSettings(Boolean, Boolean, IEnumerable<Type>, Boolean, Int32, Int32)
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 |
---|---|---|
Boolean | encodeTypeNames | Determines if a special |
Boolean | 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. |
Boolean | usePooledStringBuilder | Determines if string builders will be used from a pool to lower memory usage |
Int32 | stringBuilderMinSize | Starting size used for pooled string builders if enabled |
Int32 | stringBuilderMaxSize | Max retained size used for pooled string builders if enabled |
Fields
| Improve this Doc View SourceDefault
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
| Improve this Doc View SourceConverters
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> |
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 |
---|---|
Boolean |
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 |
---|---|
Boolean |
StringBuilderMaxSize
The Max Retained size for Pooled StringBuilders, if UsePooledStringBuilder is -true-
Declaration
public int StringBuilderMaxSize { get; }
Property Value
Type | Description |
---|---|
Int32 |
StringBuilderMinSize
The Starting size used for Pooled StringBuilders, if UsePooledStringBuilder is -true-
Declaration
public int StringBuilderMinSize { get; }
Property Value
Type | Description |
---|---|
Int32 |
UsePooledStringBuilder
If -true-, Stringbuilders are pooled and reused for serialization to lower memory pressure.
Declaration
public bool UsePooledStringBuilder { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
| Improve this Doc View SourceCreate(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 EncodeTypeNamespreserve-object-references
(boolean) mapped to PreserveObjectReferencesconverters
(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 |
ArgumentException | Raised when types defined in |