SimpleJSON err for cloud script exec:
Sorry hard to see -- I'll dig through logs soon and find a clearer version to replace, if need.
Just seeing if you know a general answer before I post details, I'm just running out the door and will come back to edit with more details.
EDIT: I pass an object "EndInfo" that contains the following:
// public string name; // public string username; // public string startClass; // public Classes.Faction startFaction; // public string finalClass; // public Classes.Faction finalFaction; // public bool won;
essentially a string, string, enum (string), string, enum (string), and bool.
EDIT 2: Works fine with postman. Now I really am wondering if I need to make a separate object just to ToString() those enums. I figured SimpleJSON would do that. This is still my latest theory.
EDIT 3: I tried some mock values within Unity - and seemed to oddly work fine:
// Works EndInfo.playerInfo mockPlayerInfo = new EndInfo.playerInfo(); mockPlayerInfo.name = "Test Name"; mockPlayerInfo.username = "TestUsername"; mockPlayerInfo.startClass = "Observer"; mockPlayerInfo.startFaction = Classes.Faction.BlueDragon; mockPlayerInfo.finalClass = "Nightwatch"; mockPlayerInfo.finalFaction = Classes.Faction.BlackRose; mockPlayerInfo.won = true;
I realized I didn't do any null checks. However, a null value shouldn't effect a SimpleJSON parse, should it? if name = null, for example. It should just do "name": ""
Sorry, I think we'll need a copy/paste of the actual error, as well as the details of the response from the ExecuteCloudScript call.
I'll see what I can do. I'll try a few more mock situations first to ensure I didn't do anything stupid :P
Here we go (working on a cloud response soon):
[0x000c6] in C:\....\Assets\PlayFabSdk\Shared\Internal\SimpleJson.cs:1049 at PlayFab.Json.PlayFabSimpleJson.SerializeValue (IJsonSerializerStrategy jsonSerializerStrategy, System.object.Value, System.Text.StringBuilder [0x0017c] in C:\....\Assets\PlayFabSDK\Shared\Internal\SimpleJson.cs:1072 at PlayFab.Json.PlayFabSimpleJson.SerializeObject (IJsonSerializerStrategy jsonSerializerStrategy, IEnumerable keys, IEnumerable values. System.Text.StringBuilder builder) [0x00087] in C:\....\Assets\PlayFabSdk\Shared\Internal\SimpleJson.cs:1098 at PlayFab.Json.PlayFabSimpleJson.SerializeValue (IJsonSerializerStrategy jsonSerializerStrategy, System.Object.Value, System.Text.StringBuilder builder)<br>
Answer by Dylan Hunt · Apr 05, 2017 at 08:57 AM
Resolved -- I thought this was BEFORE sending to PF, but it was actually both during and after --
This happens when I tried to parse the result into the object that should have returned. Instead, I had a null value.
So this was a tricky 2-part error:
1) I was returning null from CloudScript -- however, returning "successfully"
2) I tried to parse null into an object. Fail (resulting in the nasty errors above)
:)