Struct JsonMigrationContext
A migration context used to deserialize and migrate types.
Inherited Members
Namespace: Unity.Serialization.Json
Assembly: Unity.Serialization.dll
Syntax
public readonly struct JsonMigrationContext
Fields
SerializedObject
The in-memory representation of the value being deserialized.
Declaration
public readonly SerializedObjectView SerializedObject
Field Value
Type | Description |
---|---|
Serialized |
SerializedType
The serialized type as reported by the underlying stream. This can be used in contravariant migrations.
Declaration
public readonly Type SerializedType
Field Value
Type | Description |
---|---|
Type |
SerializedVersion
The deserialized version of the type.
Declaration
public readonly int SerializedVersion
Field Value
Type | Description |
---|---|
int |
UserData
The user data provided in deserialization parameters.
Declaration
public readonly object UserData
Field Value
Type | Description |
---|---|
object |
Methods
Read<TValue>()
Reads the root object as the specified TValue
type.
Declaration
public TValue Read<TValue>()
Returns
Type | Description |
---|---|
TValue | A new instance of |
Type Parameters
Name | Description |
---|---|
TValue | The value type. |
Read<TValue>(string)
Reads a top level member as the specified TValue
type.
Declaration
public TValue Read<TValue>(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The top level member name. |
Returns
Type | Description |
---|---|
TValue | A new instance of |
Type Parameters
Name | Description |
---|---|
TValue | The value type. |
Read<TValue>(SerializedValueView)
Reads the specified SerializedTValue
type.
Declaration
public TValue Read<TValue>(SerializedValueView view)
Parameters
Type | Name | Description |
---|---|---|
Serialized |
view | The serialized object. |
Returns
Type | Description |
---|---|
TValue | A new instance of |
Type Parameters
Name | Description |
---|---|
TValue | The value type. |
Read<TValue>(ref TValue, SerializedValueView)
Reads the specified Serialized
Declaration
public void Read<TValue>(ref TValue value, SerializedValueView view)
Parameters
Type | Name | Description |
---|---|---|
TValue | value | The existing reference to read in to. |
Serialized |
view | The serialized value. |
Type Parameters
Name | Description |
---|---|
TValue | The value type. |
TryRead<TValue>(string, out TValue)
Reads a top level member as the specified TValue
type.
Declaration
public bool TryRead<TValue>(string name, out TValue value)
Parameters
Type | Name | Description |
---|---|---|
string | name | The top level member name. |
TValue | value | When this method returns, contains the deserialized value, if successful. otherwise the default value for the |
Returns
Type Parameters
Name | Description |
---|---|
TValue | The value type. |
TryRead<TValue>(SerializedObjectView, out TValue)
Reads the specified SerializedTValue
type.
Declaration
public bool TryRead<TValue>(SerializedObjectView view, out TValue value)
Parameters
Type | Name | Description |
---|---|---|
Serialized |
view | The view to read. |
TValue | value | When this method returns, contains the deserialized value, if successful. otherwise the default value for the |
Returns
Type Parameters
Name | Description |
---|---|
TValue | The value type. |
TryRead<TValue>(out TValue)
Reads the root object as the specified TValue
type.
Declaration
public bool TryRead<TValue>(out TValue value)
Parameters
Type | Name | Description |
---|---|---|
TValue | value | When this method returns, contains the deserialized value, if successful. otherwise the default value for the |
Returns
Type Parameters
Name | Description |
---|---|
TValue | The value type. |