Struct JsonMigrationContext
A migration context used to deserialize and migrate types.
Inherited Members
Namespace: Unity.Serialization.Json
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 |
---|---|
SerializedObjectView |
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 |
---|---|
Int32 |
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 readonly TValue Read<TValue>()
Returns
Type | Description |
---|---|
TValue | A new instance of |
Type Parameters
Name | Description |
---|---|
TValue | The value type. |
Read<TValue>(ref TValue, SerializedValueView)
Reads the specified SerializedValueView in to the given reference.
Declaration
public readonly void Read<TValue>(ref TValue value, SerializedValueView view)
Parameters
Type | Name | Description |
---|---|---|
TValue | value | The existing reference to read in to. |
SerializedValueView | view | The serialized value. |
Type Parameters
Name | Description |
---|---|
TValue | The value type. |
Read<TValue>(String)
Reads a top level member as the specified TValue
type.
Declaration
public readonly 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 SerializedValueView as the specified TValue
type.
Declaration
public readonly TValue Read<TValue>(SerializedValueView view)
Parameters
Type | Name | Description |
---|---|---|
SerializedValueView | view | The serialized object. |
Returns
Type | Description |
---|---|
TValue | A new instance of |
Type Parameters
Name | Description |
---|---|
TValue | The value type. |
TryRead<TValue>(out TValue)
Reads the root object as the specified TValue
type.
Declaration
public readonly 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 | Description |
---|---|
Boolean | true if the value was read successfully; otherwise, false |
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 readonly 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 | Description |
---|---|
Boolean | true if the value was read successfully; otherwise, false |
Type Parameters
Name | Description |
---|---|
TValue | The value type. |
TryRead<TValue>(SerializedObjectView, out TValue)
Reads the specified SerializedValueView as the specified TValue
type.
Declaration
public readonly bool TryRead<TValue>(SerializedObjectView view, out TValue value)
Parameters
Type | Name | Description |
---|---|---|
SerializedObjectView | 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 | Description |
---|---|
Boolean | true if the value was read successfully; otherwise, false |
Type Parameters
Name | Description |
---|---|
TValue | The value type. |