question

brendan avatar image
brendan asked

Is 'null' a valid value for Custom Data on items

When adding items via GrantItemsToUsers, what we're seeing is that if we make a call like this:

[{ "PlayFabId": "1234567890ABCDEF", "ItemId": "test_1", "Data": { "foo": "bar" } }]

the call succeeds, but if it's:

[{ "PlayFabId": "1234567890ABCDEF", "ItemId": "test_1", "Data": { "foo": null } }]

it fails with the error that there's no ItemInstanceId. Is null not allowed as a value in a data object?

In-Game Economydata
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

That's correct - sending a value of null is the way you delete a key from the Custom Data of the item instance (though for languages that can't support null as the value, we also have the KeysToRemove parameter). We'll make sure to update the docs for GrantItemsToUsers, to clarify this.

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.