Today, ObjectDeliverer Ver 1.5.0 was released to the Marketplace.

ObjectDeliverer: ayumax: Code Plugins - UE4 Marketplace

The main implementation this time is the enhancement of the Object Json serialization feature.

I previously wrote about this as a current issue in a past article.

Let’s Serialize UObjects to Json - AYU MAX

This release implements features to improve the issues mentioned above.

Implemented Items

The following two items have been addressed.

Property Name Conversion

How to change property name when serializing UObject with Json(Version 1.5.0 or later) · ayumax/ObjectDeliverer Wiki · GitHub

By implementing the IODConvertPropertyName interface in the class to be serialized, property name conversion is now possible.

Usage Example)

https://user-images.githubusercontent.com/8191970/72532017-fc383700-38b5-11ea-9dc0-b73581393e35.png

// Before conversion
{
    "Prop2": 1,
    "ObjProp":
    {
        "ValueB": 0,
        "ValueA": 0
    },
    "ObjProp2":
    {
        "ValueC": "abc"
    }
}

// After conversion
{
    "IntProperty": 1,
    "ObjectPropertyA":
    {
        "ValueB": 0,
        "ValueA": 0
    },
    "ObjectPropertyB":
    {
        "ValueC": "abc"
    }
}

Using this feature allows the following:

  • Resolution of the case-insensitivity issue with FName
  • Using different property names between the target class and Json

It’s subtle but should be genuinely useful.

Selection of Serialization Format

Selection of Json serialize method in ObjectDeliveryBoxUsingJson(Version 1.5.0 later) · ayumax/ObjectDeliverer Wiki · GitHub

This is the item I put the most effort into implementing this time. It is now possible to embed the class name within the Json.

// Conventional method without class name
{
    "Prop": 1
}

// Method embedding class name
{
    "Type": "SampleClassName",
    "Body":
    {
        "Prop": 1
    }
}

This enables the following:

  • Support for serialization and deserialization of multiple classes with a single DeliveryBox
  • Restoration is possible even when an instance of a derived class is in an Object type property

Also, while the method of embedding class names alone has the advantages mentioned above, it also has the disadvantage of increasing the character count (data size). Therefore, an option is provided to switch between the conventional method and the new method depending on the Object type.

For example, it is possible to use it in a way where only certain properties embed the class name, as shown below.

{
    "Prop2": 1,
    "ObjProp":
    {
        "Type": "CustomObjB_C",
        "Body":
        {
            "ValueB": 2,
            "ValueA": 3
        }
    },
    "ObjProp2":
    {
        "ValueC": "abc"
    }
}

Summary

This time, I focused on enhancing the Object Json serialization feature.

There are still other features I want to implement, so please look forward to the steadily improving ObjectDeliverer.