Hello @LEE-JONG-GUN!
So looking into JsonConvert it looks like it actually uses LitJson underneath the hood π€
So one option to replicate the old functionality is to use BrainCloud.JsonFx.Json.JsonReader to deserialize into Dictionary<string, object> and then BrainCloud.JsonFx.Json.JsonWriter back into a string before having JObject.Parse() use it. This is basically what the old behaviour was and it would strip out trailing .0 values from JS Numbers.
SuccessCallback successCallback = (response, cbObject) => { response = JsonWriter.Serialize(JsonReader.Deserialize(response)); // Replicate the old BCComms behaviour DisplayLog(string.Format("Success | {0}", response)); JObject jsonData = JObject.Parse(response); if (jsonData["data"]["response"] != null && jsonData["status"].ToString() == "200") { scoreData = JsonConvert.DeserializeObject<ScoreData>(jsonData["data"]["response"].ToString()); // This should be working now as JsonWriter will strip trailing .0 from doubles // ... } // ... }Although you could also just use JsonReader instead of JsonConvert as this should also strip the trailing .0 so you don't have to waste CPU cycles on the serialization/deserialization:
scoreData = JsonReader.Deserialize<ScoreData>(jsonData["data"]["response"].ToString());Alternatively you can also bypass using JObjects and JsonConvert in this situation and make use of our BrainCloud.Common.JsonParser together with JsonReader like so:
SuccessCallback successCallback = (response, cbObject) => { DisplayLog(string.Format("Success | {0}", response)); if (JsonParser.GetString(response, "data", "response") is string responseData && !string.IsNullOrEmpty(responseData) && JsonParser.GetValue<int>(response, "status") == 200) // JsonParser can grab strings directly without having to do object memory allocations { scoreData = JsonReader.Deserialize<ScoreData>(responseData); // ... } // ... }I think JsonParser can be handy for grabbing strings of json objects, json arrays, and values directly without having to do memory allocations π
Let us know if any of these solutions work for you!