Struct JsonSerializationParameters | Serialization | 1.4.3-preview
docs.unity3d.com
    Show / Hide Table of Contents

    Struct JsonSerializationParameters

    Custom parameters to use for json serialization or deserialization.

    Namespace: Unity.Serialization.Json
    Syntax
    public struct JsonSerializationParameters

    Properties

    DisableRootAdapters

    By default, adapters are evaluated for root objects. Use this to change the default behaviour.

    Declaration
    public bool DisableRootAdapters { get; set; }
    Property Value
    Type Description
    Boolean

    DisableSerializedReferences

    By default, references between objects are serialized. Use this to always write a copy of the object to the output.

    Declaration
    public bool DisableSerializedReferences { get; set; }
    Property Value
    Type Description
    Boolean

    InitialCapacity

    The initial capacity (in characters) to use for the internal writer if none is provided. The default value is 32.

    Declaration
    public int InitialCapacity { get; set; }
    Property Value
    Type Description
    Int32

    Minified

    Use this parameter to write minified json.

    Declaration
    public bool Minified { get; set; }
    Property Value
    Type Description
    Boolean

    RequiresThreadSafety

    This parameter indicates if the serialization should be thread safe. The default value is false.

    Declaration
    public bool RequiresThreadSafety { get; set; }
    Property Value
    Type Description
    Boolean
    Remarks

    Setting this to true will cause managed allocations for the internal visitor.

    SerializedType

    By default, a polymorphic root type will have it's assembly qualified type name written to the output in the "$type" field. Use this parameter to provide a known root type at both serialize and deserialize time to avoid writing this information OR if this information is missing from the json string.

    Declaration
    public Type SerializedType { get; set; }
    Property Value
    Type Description
    Type

    Simplified

    Use this parameter to write simplified json.

    Declaration
    public bool Simplified { get; set; }
    Property Value
    Type Description
    Boolean

    UserData

    Stores user data which is passed to the migration adapter context.

    Declaration
    public object UserData { get; set; }
    Property Value
    Type Description
    Object

    UserDefinedAdapters

    Provide a custom set of adapters for the serialization. These adapters will be evaluated first before any global or built in adapters.

    Declaration
    public List<IJsonAdapter> UserDefinedAdapters { get; set; }
    Property Value
    Type Description
    List<IJsonAdapter>
    Remarks

    To register a global adapter see AddGlobalAdapter(IJsonAdapter).

    UserDefinedMigrations

    Provide a custom set of migration adapters for the serialization. These adapters will be evaluated first before any global or built in adapters.

    Declaration
    public List<IJsonMigration> UserDefinedMigrations { get; set; }
    Property Value
    Type Description
    List<IJsonMigration>
    Remarks

    To register a global migration see AddGlobalMigration(IJsonMigration).

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023