docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct JsonSerializationParameters

    Custom parameters to use for json serialization or deserialization.

    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Unity.Serialization.Json
    Assembly: Unity.Serialization.dll
    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 { readonly get; set; }
    Property Value
    Type Description
    bool

    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 { readonly get; set; }
    Property Value
    Type Description
    bool

    DisableValidation

    Use this parameter to disable the validation step. This can increase performance.

    Declaration
    public bool DisableValidation { readonly get; set; }
    Property Value
    Type Description
    bool

    Indent

    The indent value to use when writing.

    Declaration
    public int Indent { readonly get; set; }
    Property Value
    Type Description
    int

    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 { readonly get; set; }
    Property Value
    Type Description
    int

    Minified

    Use this parameter to write minified json.

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

    RequiresThreadSafety

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

    Declaration
    public bool RequiresThreadSafety { readonly get; set; }
    Property Value
    Type Description
    bool
    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 { readonly get; set; }
    Property Value
    Type Description
    Type

    Simplified

    Use this parameter to write simplified json.

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

    StringEscapeHandling

    If set to to true, an escape character is added before special tokens and removed upon deserialization; default value is true.

    Declaration
    public bool StringEscapeHandling { readonly get; set; }
    Property Value
    Type Description
    bool

    UserData

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

    Declaration
    public object UserData { readonly 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 { readonly 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 { readonly get; set; }
    Property Value
    Type Description
    List<IJsonMigration>
    Remarks

    To register a global migration see AddGlobalMigration(IJsonMigration).

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)