Class JsonVisitorAdapter | Package Manager UI website
docs.unity.cn
    Show / Hide Table of Contents

    Class JsonVisitorAdapter

    The JsonVisitorAdapter can be inherited to implement custom serializers for user-defined types.

    Inheritance
    System.Object
    JsonVisitorAdapter
    Namespace: Unity.Serialization.Json
    Syntax
    public abstract class JsonVisitorAdapter : IPropertyVisitorAdapter

    Constructors

    JsonVisitorAdapter(JsonVisitor)

    Initializes a new instance of JsonVisitorAdapter.

    Declaration
    protected JsonVisitorAdapter(JsonVisitor visitor)
    Parameters
    Type Name Description
    JsonVisitor visitor

    The JsonVisitor this adapter was added to.

    Methods

    Append<TProperty, TValue>(TProperty, TValue, Action<StringBuilder, TValue>)

    This method handles all of the json boilerplate for writing a property.

    The write callback will be invoked during this call and should be used to write the actual value.

    Declaration
    protected void Append<TProperty, TValue>(TProperty property, TValue value, Action<StringBuilder, TValue> write)
        where TProperty : IProperty
    Parameters
    Type Name Description
    TProperty property

    The property being written.

    TValue value

    The value being written.

    System.Action<System.Text.StringBuilder, TValue> write

    Callback invoked to write the value in a strongly typed way.

    Type Parameters
    Name Description
    TProperty

    The property type.

    TValue

    The value type.

    EncodeJsonString(String)

    Encodes the given string to be written as json. This will add any necessary escape characters.

    Declaration
    protected static string EncodeJsonString(string value)
    Parameters
    Type Name Description
    System.String value

    The string value to encode.

    Returns
    Type Description
    System.String

    The encoded string value.

    Back to top Copyright © 2019 Unity Technologies
    Generated by DocFX