docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct Value

    Read-only view over a single JSON value, used to traverse arbitrary JSON data.

    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Unity.Cloud.Gltfast.Objects
    Assembly: Unity.Cloud.Gltfast.dll
    Syntax
    public readonly ref struct Value
    Remarks

    Except for Kind and TryGetValue<T>(out T), every member requires the value to be of a particular ValueKind and throws an InvalidOperationException otherwise, including for Undefined. A Value is Undefined when it stands for "no value at all": default, the result of a failed TryGetValue(string, out Value), or RawValue of an extras that is a JSON object. Check Kind before reading.

    Properties

    ArrayLength

    The number of elements, when this value is a Array.

    Declaration
    public int ArrayLength { get; }
    Property Value
    Type Description
    int
    Exceptions
    Type Condition
    InvalidOperationException

    This value is not of kind Array.

    this[int]

    Gets the array element at index.

    Declaration
    public Value this[int index] { get; }
    Parameters
    Type Name Description
    int index

    The zero-based element index.

    Property Value
    Type Description
    Value

    The element's value.

    Exceptions
    Type Condition
    InvalidOperationException

    This value is not of kind Array.

    IndexOutOfRangeException

    index is out of range.

    this[string]

    Gets the value of the object property named key.

    Declaration
    public Value this[string key] { get; }
    Parameters
    Type Name Description
    string key

    The property name.

    Property Value
    Type Description
    Value

    The property's value.

    Exceptions
    Type Condition
    InvalidOperationException

    This value is not of kind Object.

    KeyNotFoundException

    No property named key exists. Use TryGetValue(string, out Value) to test for it.

    Kind

    The ValueKind of this value.

    Declaration
    public ValueKind Kind { get; }
    Property Value
    Type Description
    ValueKind

    Methods

    EnumerateObject()

    Returns an enumerator over the properties of this object value.

    Declaration
    public Value.ObjectEnumerator EnumerateObject()
    Returns
    Type Description
    Value.ObjectEnumerator

    An enumerator yielding each Property.

    Exceptions
    Type Condition
    InvalidOperationException

    This value is not of kind Object.

    GetBoolean()

    Gets this value as a boolean.

    Declaration
    public bool GetBoolean()
    Returns
    Type Description
    bool

    The boolean value.

    Exceptions
    Type Condition
    InvalidOperationException

    This value is of a kind other than True or False.

    GetString()

    Gets this value as a string.

    Declaration
    public string GetString()
    Returns
    Type Description
    string

    The string value, or null if the value is a JSON null.

    Exceptions
    Type Condition
    InvalidOperationException

    This value is of a kind other than String or Null.

    TryGetDouble(out double)

    Tries to get this value as a double-precision floating point number.

    Declaration
    public bool TryGetDouble(out double value)
    Parameters
    Type Name Description
    double value

    The resulting number, if successful.

    Returns
    Type Description
    bool

    true if the number is representable as a double; otherwise false. The Try covers the number's range only, not this value's kind.

    Exceptions
    Type Condition
    InvalidOperationException

    This value is not of kind Number.

    TryGetInt64(out long)

    Tries to get this value as a 64-bit signed integer.

    Declaration
    public bool TryGetInt64(out long value)
    Parameters
    Type Name Description
    long value

    The resulting integer, if successful.

    Returns
    Type Description
    bool

    true if the number is representable as a long; otherwise false. The Try covers the number's range only, not this value's kind.

    Exceptions
    Type Condition
    InvalidOperationException

    This value is not of kind Number.

    TryGetValue(string, out Value)

    Tries to get the value of the object property named key.

    Declaration
    public bool TryGetValue(string key, out Value value)
    Parameters
    Type Name Description
    string key

    The property name.

    Value value

    The resulting value, if the property exists. Of kind Undefined otherwise.

    Returns
    Type Description
    bool

    true if the property exists; otherwise false. The Try covers the property's absence only, not this value's kind.

    Exceptions
    Type Condition
    InvalidOperationException

    This value is not of kind Object.

    TryGetValue<T>(out T)

    Tries to deserialize this value to type T.

    Declaration
    public bool TryGetValue<T>(out T value)
    Parameters
    Type Name Description
    T value

    The resulting value, if successful.

    Returns
    Type Description
    bool

    true if the value was successfully deserialized; otherwise false. This includes target types that cannot be deserialized at all, like delegates or interfaces, and a value of kind Undefined, which holds nothing to convert.

    Type Parameters
    Name Description
    T

    Desired target type.

    In This Article
    Back to top
    Copyright © 2026 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)