Photon Quantum 3.0.0

Static Public Member Functions | List of all members
Quantum.Json.UnityJsonUtilityConvert Class Reference

Utility methods to convert JSON data serialized by Unity's built-in JSON utility to .NET objects with Newtonsoft.Json. More...

Static Public Member Functions

static object DeserializeObject (JObject root, Type type, JsonSerializerSettings settings=null)
 Deserializes the specified JSON object to the specified type using the provided JsonSerializerSettings. Settings must have ContractResolver set to null. More...
 
static object DeserializeObject (string json, Type type, JsonSerializerSettings settings=null)
 Deserializes the specified JSON string to the specified type using the provided JsonSerializerSettings. More...
 
static T DeserializeObject< T > (JObject root, JsonSerializerSettings settings=null)
 Deserializes the specified JSON object to the specified type using the provided JsonSerializerSettings. More...
 
static T DeserializeObject< T > (string json, JsonSerializerSettings settings=null)
 Deserializes the specified JSON string to the specified type using the provided JsonSerializerSettings. More...
 
static string SerializeObject (object value, Type rootType=null, JsonSerializerSettings settings=null)
 Serializes the specified object to a JSON string using the provided JsonSerializerSettings. More...
 

Detailed Description

Utility methods to convert JSON data serialized by Unity's built-in JSON utility to .NET objects with Newtonsoft.Json.

Member Function Documentation

◆ DeserializeObject() [1/2]

static object Quantum.Json.UnityJsonUtilityConvert.DeserializeObject ( JObject  root,
Type  type,
JsonSerializerSettings  settings = null 
)
inlinestatic

Deserializes the specified JSON object to the specified type using the provided JsonSerializerSettings. Settings must have ContractResolver set to null.

Parameters
rootThe JSON object to deserialize.
typeThe type to deserialize the JSON object to.
settingsThe JsonSerializerSettings to use for deserialization. (optional)
Returns
The deserialized object.

◆ DeserializeObject() [2/2]

static object Quantum.Json.UnityJsonUtilityConvert.DeserializeObject ( string  json,
Type  type,
JsonSerializerSettings  settings = null 
)
inlinestatic

Deserializes the specified JSON string to the specified type using the provided JsonSerializerSettings.

Parameters
jsonThe JSON string to deserialize.
typeThe type to deserialize the JSON string to.
settingsThe JsonSerializerSettings to use for deserialization. (optional)
Returns
The deserialized object.

◆ DeserializeObject< T >() [1/2]

static T Quantum.Json.UnityJsonUtilityConvert.DeserializeObject< T > ( JObject  root,
JsonSerializerSettings  settings = null 
)
inlinestatic

Deserializes the specified JSON object to the specified type using the provided JsonSerializerSettings.

Template Parameters
TThe type to deserialize the JSON object to.
Parameters
rootThe JSON object to deserialize.
settingsThe JsonSerializerSettings to use for deserialization. (optional)
Returns
The deserialized object.

◆ DeserializeObject< T >() [2/2]

static T Quantum.Json.UnityJsonUtilityConvert.DeserializeObject< T > ( string  json,
JsonSerializerSettings  settings = null 
)
inlinestatic

Deserializes the specified JSON string to the specified type using the provided JsonSerializerSettings.

Template Parameters
TThe type to deserialize the JSON string to.
Parameters
jsonThe JSON string to deserialize.
settingsThe JsonSerializerSettings to use for deserialization. (optional)
Returns
The deserialized object.

◆ SerializeObject()

static string Quantum.Json.UnityJsonUtilityConvert.SerializeObject ( object  value,
Type  rootType = null,
JsonSerializerSettings  settings = null 
)
inlinestatic

Serializes the specified object to a JSON string using the provided JsonSerializerSettings.

Parameters
valueThe object to serialize.
rootTypeThe root type of the object. (optional)
settingsThe JsonSerializerSettings to use for serialization. (optional)
Returns
The serialized JSON string.