-
Notifications
You must be signed in to change notification settings - Fork 38
Selection of Json serialize method in ObjectDeliveryBoxUsingJson(Version 1.5.0 later)
In Version 1.5.0 or later, the Json serialization format of UObject can be selected from the following two types.
- Do not include the class name (conventional format)
{
"Prop": 1
}
- Include class name
{
"Type": "SampleClassName",
"Body":
{
"Prop": 1
}
}
By including the class name in json, multiple types can be serialized and deserialized in one DeliveryBox. Even if you have an object as a property of the type of the base class, the information will not be lost.
But the class name is saved for each object, so the number of characters (data size) of json increases.
I will explain in the case of serialization of the blueprint below
- The class name of this blueprint is
CustomObject1
- Has a property named Prop2 for
Integer
- Has a property named ObjProp of type
CustomObjA
- ObjProp contains an instance of
CustomObjB
-
CustomObjB
inherits fromCustomObjA
- Has a property named ObjProp2 of type
CustomObjC
Create a Delivery Box using Create Object Delivery Box Using Json
.
Serialized to the following json text
{
"Prop2": 1,
"ObjProp":
{
"ValueB": 2,
"ValueA": 3
},
"ObjProp2":
{
"ValueC": "abc"
}
}
- Class names are not saved
- When deserializing, it is necessary to specify the target class (CustomObject1)
- ObjProp is restored as
CustomObjA
type, so ValueB implemented inCustomObjB
is not restored
Create a Delivery Box using Create Dynamic Object Delivery Box Using Json
.
Serialized to the following json text
{
"Type": "CustomObject1_C",
"Body":
{
"Prop2": 1,
"ObjProp":
{
"Type": "CustomObjB_C",
"Body":
{
"ValueB": 2,
"ValueA": 3
}
},
"ObjProp2":
{
"Type": "CustomObjC_C",
"Body":
{
"ValueC": "abc"
}
}
}
}
- Class names are saved
- No need to specify target class (CustomObject1) when deserializing
- ObjProp is restored as "CustomObjB" type, so ValueB implemented in "CustomObjB" is also restored
Create a Delivery Box using Create Custom Object Delivery Box Using Json
.
Serialized to the following json text(For the above image settings)
{
"Prop2": 1,
"ObjProp":
{
"Type": "CustomObjB_C",
"Body":
{
"ValueB": 2,
"ValueA": 3
}
},
"ObjProp2":
{
"ValueC": "abc"
}
}
- Set the default serialization method type to
Default Serializer Type
- If you specify
No Write Type
in Default Serializer Type, you must always specifyTarget Class
. - Set the object class and serialization method type of the property as a pair in
Object Serializer Types