question

Derek avatar image
Derek asked

Can we use PlayFabSimpleJSON in the build? (Unity)

Hello,

I am using Unity to working on a mobile game, I want to use PlayFabSimpleJson class to deserialise object. But looking into the code, it says "Private. Do not call from client code."

Is that mean we cannot use it in build? Or we can use it unless we uncomment "#define SIMPLE_JSON_INTERNAL" and make the class internal?

Derek

sdks
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

·
Sarah Zhang avatar image
Sarah Zhang answered

We would suggest you use the method implemented in the public class PluginManager to deserialize the string of the object. You can follow this code snippet to convert the object data to a dictionary then retrieve the value based on the specific key name.

//Convert the pre-defined object to a dictionary.
Dictionary<string, object> testDic = PlayFab.PluginManager.GetPlugin<ISerializerPlugin>(PluginContract.PlayFab_Serializer).DeserializeObject<Dictionary<string, object>>(dataObject.ToString());
object testValue;
//Replace the Skill with the key name.
if (testDic.TryGetValue("Skill", out testValue))
{
Debug.Log("testValue.ToString():" + testValue.ToString());//Convert the object to string if you need to log it, you can also convert it to other types you need.
}
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.