question

walldiv avatar image
walldiv asked

Catalog.CustomData -> Nested Objects supported?

{
    "mesh": [
            {"SK_Female":"SkeletalMesh'/Game/Characters/Survivors/Female/Upperbody/CrewNeck/F_Upperbody_CrewNeck_a.F_Upperbody_CrewNeck_a'"},
            {"SK_Male":"SkeletalMesh'/Game/Characters/Survivors/Male/Upperbody/CrewNeck/M_Upperbody_CrewNeck_a.M_Upperbody_CrewNeck_a'"}
    ],
    "materials": [
            {"Material_0":"MaterialInstanceConstant'/Game/Characters/Survivors/_ClothingDecals/Generic_Logos/MI_VecFourLogo.MI_VecFourLogo'"},
            {"Material_1":"Material'/Game/Characters/Survivors/Male/Upperbody/CrewNeck/Skins/MI_Upperbody_CrewNeck_a_Default.MI_Upperbody_CrewNeck_a_Default'"},
            {"Material_2":"Material'/Game/Characters/Survivors/Male/Upperbody/CrewNeck/Skins/MI_Upperbody_CrewNeck_a_Gold.MI_Upperbody_CrewNeck_a_Gold'"}
    ]   
}

I have what I believe to be a properly formatted JSON response (at least it checks out in JSON Checkers online as good) and embedding this into CustomData. Here's my problem i'm facing:

Firstly, CustomData when returning very long strings seems to chop off at a character limit.... 277 each string that was cut off was that same exact number. So having anything beyond this is being cut off, and thus unuseable.

Secondly - using the below format for a JSON Nested Objects (or what I believe to be as good) isn't returning anything. I cant even get the JSON->AsObject->Encode and print it.... but if I do JSON->AsString and print it - it shows the information there as string output....

How do I nest objects inside of CustomData properly so I don't run into CharacterReturn limits on string text? Yes - character strings are going to be quite lengthy in return values, but not reaching beyond 277 limits like the entire JSON return was doing previously (as String return of entire JSON before the formatting applied below)

unreal
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

walldiv avatar image walldiv commented ·

FWIW - there is a misconception here from UE4.... the returned LENGTH of the text characters was indeed full length and NOT chopped off at 277 - that was a window character limit within UE4's output log.... we found that the returned string was indeed full length....

But I am still wanting to learn how to embed objects within CustomData object from an InventoryItem type..... it would make really nice utility to pull as a string/object field instead of parsing strings & separating into variables via actual text string parsing.

0 Likes 0 ·

1 Answer

·
Seth Du avatar image
Seth Du answered

CustomData field in catalog is used to store String values. It is by design.

You can define your own class in your scripts and initialize your object via the string value so that it may reduce the handling time. Separating string into different variables is not an ideal solution. You should consider looking for tutorials like ‘convert json data into object’. PlayFab has json handler which is PlayFab.Json.JsonWrapper (in C#), where you can use JsonWrapper.Serialize and JsonWrapper.Deserialize to manage your data. Please see the source code at PlayFabSdk\Shared\Internal\ISerializer.cs (Unity SDK as an example)

Additionally, we have made a test demo to see if there is escape characters when the retrieval of CustomData that may make json data hard to be converted and as far as we can see from the result, the data stays the original format. We recommend you to use regex to filter the string on the basis of your needs before converting them into objects.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.