Hi,
is there a way to serialize/deserialize an enum as a string with PlayFabSimpleJson?
(
like with newtonsoftjson =>
[JsonConverter(typeof(StringEnumConverter))]
public EEnum _enum;
)
Thanks.
Hi,
is there a way to serialize/deserialize an enum as a string with PlayFabSimpleJson?
(
like with newtonsoftjson =>
[JsonConverter(typeof(StringEnumConverter))]
public EEnum _enum;
)
Thanks.
I assume you are using c# or Unity SDK. Enum is a value type data type in C# and its value will be converted to string if you are using PlayFab_Serializer in PluginManager via:
PlayFab.PluginManager.GetPlugin<ISerializerPlugin>(PluginContract.PlayFab_Serializer)
Here is an example, I am trying to serialize a list of "SetObject" object for SetObjects API
void Start() { var data = new Dictionary < string, object > () { { "Health", 100 }, { "Mana", test.max } }; var dataList = new List < SetObject > () { new SetObject() { ObjectName = "PlayerData", DataObject = data } }; string a = PlayFab.PluginManager.GetPlugin < ISerializerPlugin > (PluginContract.PlayFab_Serializer).SerializeObject(dataList); print(a); } public enum test { max, medium, zero }
You may see the test.max will be printed as "max".
3 People are following this question.