Sign In Register

How can we help you today?

Start a new topic

Fields in JSON stored in GameDataService do not have correct types in CloudCode


I've migrated over to using GameDataService, however I've found what is a pretty critical bug for me. It seems the data types of fields on JSON stored in GDS are not the correct types within Cloud Code. They're all treated as 'object'. Here's what I mean:


//** Assume this JSON is stored in TEST
   "one": 1

var test = gds.getItem('PlayerData', 'TEST').document().getData();
typeof( // "object"

var test2 = { "one": 1 }
typeof( // "number" 


This makes it near impossible to do any sort of comparison on the data, which is something we do a lot of. For instance: == 1 // false == 1 // true

This also applies to strings when using strict (===) comparison. 

This seems like a pretty major bug to me, but maybe there's something I'm missing?

I should note that the problem really comes into play when trying to compare data on two different items from the GameDataServices. Since properties are seen as objects, two properties won't equal the same even if they have the same value. 

I've worked around this issue by using parseInt and toString, but that feels like a rather bad solution. 

Hi Jason,

Thanks for raising this. We've got it in our backlog and will be addressing it in an upcoming sprint. I'll be in touch when it has been released.



Hi there,

This issue is also happening on our side, we r saving null values for string while getting them 0 as integer on our C# unity app. which in turn is not letting our deserialise the data and throwing errors.

When can we expect this fix?

Its very very important for us


Login to post a comment