Class NewtonSoftJsonSerializerSettings
A typed settings for a NewtonSoftJsonSerializer class.
Inherited Members
Namespace: Akka.Serialization
Assembly: Akka.dll
Syntax
public sealed class NewtonSoftJsonSerializerSettings
Constructors
| Edit this page View SourceNewtonSoftJsonSerializerSettings(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 |
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 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
| Edit this page 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 |
---|---|
bool |
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 |
StringBuilderMaxSize
The Max Retained size for Pooled StringBuilders, if UsePooledStringBuilder is -true-
Declaration
public int StringBuilderMaxSize { get; }
Property Value
Type | Description |
---|---|
int |
StringBuilderMinSize
The Starting size used for Pooled StringBuilders, if UsePooledStringBuilder is -true-
Declaration
public int StringBuilderMinSize { get; }
Property Value
Type | Description |
---|---|
int |
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 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 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 |
ArgumentException | Raised when types defined in |