Hi everyone!
I’ve been working on a serialization framework for Unreal Engine. Recently I’ve got a new release with roundtrip-able serializers and JSON/MsgPack support. See : Introducing DataConfig 1.2.
In short DataConfig is an open source C++ library implementing serialization framework that allows custom logic. A classic example is converting FColor
between a hex string#RRGGBBAA
for example:
USTRUCT()
struct FDcExtraTestStructWithColor1
{
GENERATED_BODY()
UPROPERTY() FColor ColorField1;
UPROPERTY() FColor ColorField2;
};
FString Str = TEXT(R"(
{
"ColorField1" : "#0000FFFF",
"ColorField2" : "#FF0000FF",
}
)");
DataConfig makes it trivia to implement the conversion logic and it works recursively.
Additionally we have more cool examples:
-
USTRUCT() struct FDcExtraTestStructWithBase64 { GENERATED_BODY() UPROPERTY(meta = (DcExtraBase64)) TArray<uint8> BlobField1; UPROPERTY(meta = (DcExtraBase64)) TArray<uint8> BlobField2; }; FString Str = TEXT(R"( { "BlobField1" : "dGhlc2UgYXJlIG15IHR3aXN0ZWQgd29yZHM=", "BlobField2" : "", } )");
-
AnyStruct. We have
FDcAnyStruct
that can store a heap allocated struct of any type:FString Str = TEXT(R"( { "AnyStructField1" : { "$type" : "DcExtraTestSimpleStruct1", "NameField" : "Foo" }, "AnyStructField2" : { "$type" : "DcExtraTestStructWithColor1", "ColorField1" : "#0000FFFF", "ColorField2" : "#FF0000FF" }, "AnyStructField3" : null } )");
If you’re coming from Unity3D then DataConfig is basically FullSerializer or OdinSerializer implemented for UE
If you’re a C++ programmer doing JSON read write in Unreal Engine you should give this a try. We implemented new JSON parser and writer with no external dependency. It supports relaxed JSON spec that allows // line commnet
, /* block comment*/
and trailing comma.
We also have a separated plugin DataConfig JSON Asset on the market place.
It allows batch and auto reimport of JSON into DataAsset.
We think it’s pretty cool and useful. Post your questions and feedback here