question

daniel.berkbox@gmail.com avatar image
daniel.berkbox@gmail.com asked

Deserialize a Cloud Script Result

Hi,

Some example how I can deserialize  a cloud script result ?

I have try tried PlayFab.SimpleJson.DeserializeObject but that is returning null (the response is ok Result.Results.ToString() looks like a valid json)

Thank you!

 

 

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

Absolutely - what you want to use is actually the ResultsEncoded for this. We have examples of this in our Samples repo in GitHub. For example, in the CrossPromotional example, you'll see the call to DeserializeObject in OnCheckinCallback (https://github.com/PlayFab/PlayFab-Samples/blob/5b95b32bfec9219a970e97a0b5a424b64ef6276e/Recipes/SimpleCrossPromotion/Unity3d-Example/CrossPromotional/Assets/PlayFab_Recipes/CrossPromotional/Scripts/CrossPromotional.cs) is like this:

 

List<ItemInstance> grantedItems = PlayFab.SimpleJson.DeserializeObject<List<ItemInstance>>(result.ResultsEncoded);

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.