Class JsonSerializer
Objects serialization tool (json format).
Inheritance
Namespace: FlaxEngine.Json
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public static class JsonSerializer : Object
Methods
Deserialize(Object, Byte*, Int32)
Deserializes the specified object (from the input json data).
Declaration
public static void Deserialize(object input, byte *jsonBuffer, int jsonLength)
Parameters
System.Object
input
The object. |
System.Byte*
jsonBuffer
The input json data buffer (raw, fixed memory buffer). |
System.Int32
jsonLength
The input json data buffer length (characters count). |
Deserialize(Object, String)
Deserializes the specified object (from the input json data).
Declaration
public static void Deserialize(object input, string json)
Parameters
System.Object
input
The object. |
System.String
json
The input json data. |
Deserialize(String)
Deserializes the .NET object (from the input json data).
Declaration
public static object Deserialize(string json)
Parameters
System.String
json
The input json data. |
Returns
System.Object
The deserialized object from the JSON string. |
Deserialize(String, Type)
Deserializes the specified .NET object type (from the input json data).
Declaration
public static object Deserialize(string json, Type objectType)
Parameters
System.String
json
The input json data. |
System.Type
objectType
The System.Type of object being deserialized. |
Returns
System.Object
The deserialized object from the JSON string. |
Deserialize<T>(String)
Deserializes the specified .NET object type (from the input json data).
Declaration
public static T Deserialize<T>(string json)
Parameters
System.String
json
The input json data. |
Returns
T
The deserialized object from the JSON string. |
Type Parameters
T
The type of the object to deserialize to. |
GetStringID(Object)
Gets the string representation of the given object. It matches the internal serialization formatting rules.
Declaration
public static string GetStringID(Object obj)
Parameters
Object
obj
The object. |
Returns
System.String
The serialized ID. |
GetStringID(Guid)
Gets the string representation of the given object ID. It matches the internal serialization formatting rules.
Declaration
public static string GetStringID(Guid id)
Parameters
System.Guid
id
The object identifier. |
Returns
System.String
The serialized ID. |
GetStringID(Guid*)
Gets the string representation of the given object ID. It matches the internal serialization formatting rules.
Declaration
public static string GetStringID(Guid*id)
Parameters
System.Guid*
id
The object identifier. |
Returns
System.String
The serialized ID. |
LoadFromBytes(ISerializable, Byte[], Int32)
Performs object Json deserialization from the raw bytes.
Declaration
[Unmanaged]
public static void LoadFromBytes(ISerializable obj, byte[] data, int engineBuild)
Parameters
ISerializable
obj
The object to deserialize (can be null). |
System.Byte[]
data
The source data to read from. |
System.Int32
engineBuild
The engine build number of the saved data. Used to resolve old object formats when loading deprecated data. |
ParseID(String)
Parses the given object identifier represented in the internal serialization format.
Declaration
public static Guid ParseID(string str)
Parameters
System.String
str
The ID string. |
Returns
System.Guid
The identifier. |
ParseID(String, out Guid)
Parses the given object identifier represented in the internal serialization format.
Declaration
public static void ParseID(string str, out Guid id)
Parameters
System.String
str
The ID string. |
System.Guid
id
The identifier. |
SaveToBytes(ISerializable)
Performs object Json serialization to the raw bytes.
Declaration
[Unmanaged]
public static byte[] SaveToBytes(ISerializable obj)
Parameters
ISerializable
obj
The object to serialize (can be null). |
Returns
System.Byte[]
The output data. |
Serialize(Object, Boolean)
Serializes the specified object.
Declaration
public static string Serialize(object obj, bool isManagedOnly = false)
Parameters
System.Object
obj
The object. |
System.Boolean
isManagedOnly
True if serialize only C# members and skip C++ members (marked with UnmanagedAttribute). |
Returns
System.String
The output json string. |
Serialize(Object, Type, Boolean)
Serializes the specified object.
Declaration
public static string Serialize(object obj, Type type, bool isManagedOnly = false)
Parameters
System.Object
obj
The object. |
System.Type
type
The object type. Can be typeof(object) to handle generic object serialization. |
System.Boolean
isManagedOnly
True if serialize only C# members and skip C++ members (marked with UnmanagedAttribute). |
Returns
System.String
The output json string. |
SerializeDiff(Object, Object, Boolean)
Serializes the specified object difference to the other object of the same type. Used to serialize modified properties of the object during prefab instance serialization.
Declaration
public static string SerializeDiff(object obj, object other, bool isManagedOnly = false)
Parameters
System.Object
obj
The object. |
System.Object
other
The reference object. |
System.Boolean
isManagedOnly
True if serialize only C# members and skip C++ members (marked with UnmanagedAttribute). |
Returns
System.String
The output json string. |
ValueEquals(Object, Object)
The default implementation of the values comparision function used by the serialization system.
Declaration
public static bool ValueEquals(object objA, object objB)
Parameters
System.Object
objA
The object a. |
System.Object
objB
The object b. |
Returns
System.Boolean
True if both objects are equal, otherwise false. |