question

Marty Burgess avatar image
Marty Burgess asked

UpdateUserData question regarding JSON arrays

Hi guys,

So i'm playing around with UpdateUserData, and i seem to have a weird issue when i try to send JSON data that contains arrays. I've tested this both within UE4 blueprint sdk, as well as using postman. when i try to send the following request, i receive back code 200 and an updated DataVersion count, but the data doesn't appear on that users player data page.

any ideas?

{
  "Data": {
    "name":"John",
    "age":30,
    "cars": [
        { "name":"Ford", "models":[ "Fiesta", "Focus", "Mustang" ] },
        { "name":"BMW", "models":[ "320", "X3", "X5" ] },
        { "name":"Fiat", "models":[ "500", "Panda" ] }
    ]
 },
  "Permission": "Public"
}
10 |1200

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

1 Answer

·
brendan avatar image
brendan answered

User Data is arbitrary string/string key/value pair data, so what you'll want to do is stringify the array before you send it up as the value for the key. However, I would actually recommend making everything in your data block be a single key/value pair in our service, as a stringified JSON object. Very small data is very inefficient in our service currently, so the "name" and "age" items would be best packed in with the "cars". We'll be updating our data model in an upcoming sprint to provide for more efficient usage with small data values.

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.