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

Hi,


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(test.one) // "object"

var test2 = { "one": 1 }
typeof(test2.one) // "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:


 

test.one == 1 // false
test2.one == 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.


Regards,

Liam

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 Json.net deserialise the data and throwing errors.


When can we expect this fix?

Its very very important for us


Thanks

Login to post a comment